Controlled Inputs
In React, form inputs can be "controlled" by React state. This means React becomes the single source of truth for the input's value.
What is a Controlled Input?
A controlled input is one where React controls the value through state:
The Controlled Input Pattern
The key to controlled inputs is the two-way binding between state and the input:
Why Use Controlled Inputs?
Controlled inputs give you complete control over the data:
Exercise: Create a Controlled Input
Exercise: Input with Transformation
Exercise: Number-Only Input
Different Input Types
React controls different input types in similar ways:
Key Takeaways
- Controlled inputs - React state is the single source of truth
- value + onChange - The two props that make inputs controlled
- Immediate access - Always know the current value
- Transform on change - Modify values before storing
- Validation - Check values as the user types
Up next · Lesson 21 of 33
Form Handling
6 min read
20 of 33 lessons done

Ask Byte about this lesson
A private chat about this lesson. Byte has read the whole lesson, answers in seconds, and shows the section each answer comes from. Ask follow-ups in any language.
Questions & Answers
Public questions about this lesson. The AI Tutor answers right away in your language, the FreeAcademy team checks answers, and every learner can read them.

