React Forms and Controlled Input

React Basics Continued

Yesterday I continued studying React basics. I went through forms and how to add two properties to an input element such that it becomes controlled:

  1. value={state}: This ensures the value of the input displayed is changed whenever state changes from inside the component, by code.
  2. onChange={() => handleChange(e)}: This ensures state changes whenever the value of the input is changed by the user.