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 https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label 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