What is the work of id in input tag React ?

Normally We use , id attribute in input tag React like –

<input
 id="new-todo"
 />

OR

<input
 id="new-todo"
 onChange={this.handleChange}
 value={this.state.text}
  />

‘id’ is only used by the React engine to work out what elements of the DOM need to be re-written when there are changes to state or props in components.

Sometimes , you’ll want to add labels to go with your input elements , there also you have to use ‘id ‘ attribute with input tag , like –

 <label htmlFor="new-todo">
       What needs to be done?
  </label>
  <input
     id="new-todo"
     onChange={this.handleChange}
     value={this.state.text}
   />

So , When you will click on label , than it points out the input .