4 ms·
I always assumed `class` was a keyword, which is why then went with `className` instead.
by syntor 9y ago
I always assumed `class` was a keyword, which is why then went with `className` instead.
- sorahn 9y agoboth `className` and `htmlFor` are what the actual DOM uses. [1][2] [1]: https://developer.mozilla.org/en-US/docs/Web/API/Element/className https://developer.mozilla.org/en-US/docs/Web/API/Element/cla... [2]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/htmlFor https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelEl...
- danabramov 9y agoYes, the reason is that you can't write something like const { class } = props Which is very common and deeply confusing. So even though "class" will technically work now, it will still warn, and ask that you use "className". (And officially supporting both would make it confusing for third party components since each would have to also support both.)