Skip to main content

Forms and Inputs

2 lessonsAbout 12 minutesIntermediate

This part of the React Tutorial runs from Controlled Inputs through to Form Submission and Validation. There are 2 lessons here, and working through them takes about 12 minutes at a steady pace.

It follows on from Lists and Keys, so finish that first if you have not already — the examples below assume you are comfortable with it.

Each lesson below says what it covers before you open it. Read them in order the first time; afterwards this page works as a index you can jump back into when you need to check one thing.

  1. 1Controlled InputsA controlled input takes its value from React state. Learn the pattern, why an input can go read-only by accident, and how to handle each input type.
  2. 2Form Submission and ValidationHandle React form submission with onSubmit and preventDefault, validate input, and show errors only after the user has interacted.