How to use React label element?
If you try to render a <label>
element bound to a text input using the standard for
attribute, then it produces HTML missing that attribute and prints a warning to the console.
<label for={'user'}>{'User'}</label><input type={'text'} id={'user'} />
Since for
is a reserved keyword in JavaScript, use htmlFor
instead.
<label htmlFor={'user'}>{'User'}</label><input type={'text'} id={'user'} />
December 24, 2021
3182
Read more
What is React?
November 06, 2022
ReactJSHow to programmatically trigger click event in React?
November 06, 2022
ReactJS