score:698

Accepted answer

the for attribute is called htmlfor for consistency with the dom property api. if you're using the development build of react, you should have seen a warning in your console about this.

score:3

that is htmlfor in jsx and class is classname in jsx

score:4

just using react htmlfor to replace for!

since for is a reserved word in javascript, react elements use htmlfor instead.

refs

you can find more info by following the below links.

https://facebook.github.io/react/docs/dom-elements.html#htmlfor

https://github.com/facebook/react/issues/8483

https://github.com/facebook/react/issues/1819

score:9

both for and class are reserved words in javascript this is why when it comes to html attributes in jsx you need to use something else, react team decided to use htmlfor and classname respectively

score:20

for react you must use it's per-define keywords to define html attributes.

class -> classname

is used and

for -> htmlfor

is used, as react is case sensitive make sure you must follow small and capital as required.

score:62

yes, for react,

for becomes htmlfor

class becomes classname

etc.

see full list of how html attributes are changed here:

https://facebook.github.io/react/docs/dom-elements.html


Related Query

More Query from same tag