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

jsx: className attr transform is applied to "uppercase components" #275

Open
jchavarri opened this issue Aug 23, 2020 · 0 comments
Open

Comments

@jchavarri
Copy link
Contributor

It seems JSX ppx renames className attribute to class for elements generated from uppercase components. This results in the createElement application being passed a ~class argument, which doesn't make sense as it's a reserved word.

To repro:

module Foo = {
  let createElement = (~className, ()) => {
    <div className />;
  };
};
let el = <Foo className="bar" />

Error:

The function applied to this argument has type
  (~className: Tyxml.Html.wrap(Html_types.nmtokens)) => Tyxml_html.elt([> Html_types.div ])
This argument cannot be applied with label ~class

Should attribute mangling only be applied to elements generated from lowercase components?

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

1 participant