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

Support for class attribute instead of className in JSX #626

Closed
goldenice opened this issue Sep 11, 2016 · 1 comment
Closed

Support for class attribute instead of className in JSX #626

goldenice opened this issue Sep 11, 2016 · 1 comment

Comments

@goldenice
Copy link

I'd love to see support for this babel plugin out of the box. With this plugin I don't have to switch context in my head whether I'm writing HTML or JSX, it has the advantage of making JSX a superset of HTML instead of just a slightly different formatted language.

I'd like to hear some thoughts on this from people more submerged in the React world 😄

@fson
Copy link
Contributor

fson commented Sep 11, 2016

Thanks for the suggestion. While maybe handy, I don't think this plugin is a good fit for Create React App. It would likely cause confusion, because components written to use this plugin won't work without it. People would copy-paste code to a different project and it wouldn't work. In the end this question boils down to similar reasoning as #603. The plugin also isn't very popular – most people are just using className and I think it makes sense for create-react-app to follow the existing conventions in the community.

Supporting the class attribute has been suggested in React (facebook/react#5926) and it's possible that this might change in the future, but that change should happen in React, not only in Create React App. Otherwise we would be fragmenting the ecosystem.

Note that even with this plugin, JSX isn't a true superset of HTML, because of small differences like self-closing tags and prop values that can be of any JavaScript type. There's also a good explanation of why React has className instead of class here

@fson fson closed this as completed Sep 11, 2016
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants