React Design Patterns and Best Practices(Second Edition)
上QQ阅读APP看书,第一时间看更新

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.