javascript - Using the for attribute in JSX - linter unknown property "for" -
i have label input. want make whole label area clickable trigger input (a checkbox). have used for
attribute believe intended for:
<label for={id}> <input name="checkbox" type="radio" data-id={id} /> </label>
functionally works linter not it:
error unknown property 'for' found, use 'htmlfor' instead react/no-unknown-property
htmlfor
not appear have same functionality for
attribute.
how can change code make work whilst retaining functionality of for
- i'd rather avoid writing custom function selects correlating checkbox when click on label when functionality exists for
nothing special need do.try this,
<input name="checkbox" type="radio" data-id={id} /> <label htmlfor={id}></label>
Comments
Post a Comment