LABELS IN REACT
IN JSX, FOR LABELS WE DONOT USE for AS IT IS A RESERVED KEYWORD (for loop). INSTEAD WE USE htmlFor.
<form>
<label htmlFor="name">Name:</label>
<input placeholder="enter name" value={name} onChange={getChange} id="name" type="text"/>
<button>submit</button>
</form>
);
BUT IN THE DOM , IT WILL BE DISPLAYED AS for.


Comments
Post a Comment