Ask questionsWarning: Unknown DOM property for. Did you mean htmlFor?

I get this warning whenever I attempt to use the for property on a <label> element. See for a description of the for attribute.


Answer questions AMorgaut

I find this Error message counter intuitive

Looking at:

Warning: Unknown DOM property for. Did you mean htmlFor?

Any Wev developer new to React (or using this attribute in JSX for the 1st time) will think

WTF! how can the DOM <label> "for" property be Unknown! It's been here for ages !

Looking at the number of projects linking to this issue is a good hint to see what I mean.

A more accurate Error message could be something like

Warning: Unknown JSX property for. Did you mean htmlFor?

This would more rapidly point to the right direction


Related questions

Disable react strict mode on third party libraries hot 3
Warning: validateDOMNesting(...): <tr> cannot appear as a child of <table> hot 2
React@16.9 block `javascript:void(0);` hot 2
React custom hook "Should have a queue. This is likely a bug in React" error message. hot 1
TypeError: Object(...) is not a function hot 1
useEffect causes 'callback is not a function' exception hot 1
DevTools: Updating state or props in devtools does not trigger component update. hot 1
Invariant Violation: Invalid hook call. Hooks can only be called inside of the body of a function component hot 1
eslint-plugin-react-hooks v2.0.0 is not loaded correctly. hot 1
Old references retained by memoizedProps in fiber hot 1
Stale values for useState inside callback functions hot 1
ReactDomServer - renderToString Failing with Context Provider on IE11 hot 1
Keep getting `TypeError: Cannot read property 'scrollTop' of null` in a custom hook... hot 1
Route based code splitting, Loading chunk 0 failed after new deployment hot 1
map through connected component, get data of last saga call within all componenets hot 1
Github User Rank List