Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable as a JSX parameter is broken #53

Closed
armed opened this issue Aug 13, 2022 · 3 comments
Closed

Variable as a JSX parameter is broken #53

armed opened this issue Aug 13, 2022 · 3 comments

Comments

@armed
Copy link

armed commented Aug 13, 2022

Cherry version: 0.0.0-alpha.54

Two issues:

  • argument is not wrapped with curly brackets, eg. href={ url }
  • name of an argument does not contain an index url instead of url1
(defn foo []
  (let [url "www.example.com"]
    #jsx [:a {:href url} "Go"]))

compiles to

var foo = function () {
  let url1 = "www.example.com";
  {
    let x2 = <a href=url >{"Go"}</a>
    ;
    return x2;
  }
};

export { foo }
@borkdude
Copy link
Member

Thanks! There's currently more broken, I think the jsx stuff needs to be deeper integrated into the compiler to support if etc but the above is fairly easy to fix I think.

@borkdude
Copy link
Member

I investigated this issue and there is no quick hack to fix this. We need to support JSX as part of the compiler and not as a quick hack like I did before. I will look into this to better support JSX both in cherry and clavascript.

@borkdude
Copy link
Member

Should work now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants