EsLint rule for label

Case 1: You can make input inside label

      <input type="text"/>

case 2: use htmlFor

   <label htmlFor="first-name">
        First Name
   <input type="text" id="first-name" />

you can go through the details of rules through this page:


According to docs:

Case: The label is a sibling of the control.

<label htmlFor={domId}>Surname</label>
<input type="text" id={domId} />

Leave a Comment