Are there any other HTML attributes that are reserved keywords in JavaScript that I wont be able to use in JSX?

Question

Are there any other HTML attributes that are reserved keywords in JavaScript that I wont be able to use in JSX?

Answer

In JSX, some HTML attributes will use camelCase and/or a different attribute name, but the two main attributes to be aware of (as we’ll use these most often and because their original HTML attribute name is a reserved JavaScript keyword) are:

  • class - which will be className in JSX
  • for - which will be htmlFor in JSX

To read about more HTML attributes that use different names in JSX, check the React documentation for Tags and Attributes.

20 Likes