- React Design Patterns and Best Practices(Second Edition)
- Carlos Santana Roldán
- 76字
- 2021-06-24 15:43:38
Attributes
We must always keep in mind that JSX is not a standard language, and that it gets transpiled into JavaScript. Because of this, some attributes cannot be used.
For example, instead of class we have to use className, and instead of for we have to use htmlFor, as follows:
<label className="awesome-label" htmlFor="name" />
The reason for this is that class and for are reserved words in JavaScript.