
Lesson 05 · 11 min
A controlled input
You take the field's value from state and write it back in onChange. One source of truth.
A controlled input: value={title} and onChange={(e) => setTitle(e.target.value)}. React draws what's in state. Uncontrolled (defaultValue + ref) exists too, but for a form with validation and a "submit" button control is simpler: you always know what's on screen.
Sign in to continue
The rest of this lesson opens after sign up
The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.