Hacker News new | ask | show | jobs
by Bahamut 3419 days ago
className was named that to avoid conflict with the JS class syntax originally I believe, since JSX is inline - they probably could put in the work to change it at this point, but it seems like a minimally beneficial change but massively disruptive at this point.
2 comments

It was named that to match the DOM api[0], which React does whenever possible. The DOM api is probably named for the reason you state.

[0]: https://developer.mozilla.org/en-US/docs/Web/API/Element/cla...

And the reason why the DOM API uses className is: class is a reserved keyword in JavaScript for a long time.
There's also stuff like onClick, readOnly, xlinkHref... I would guess that a healthy number of React-related google searches are related to these gotchas