SyntaxStudy
Sign Up
React Controlled Inputs with onChange
React Beginner 1 min read

Controlled Inputs with onChange

A controlled input is one where React state is the single source of truth for the input's value. You set `value={stateVariable}` and provide an `onChange` handler that updates state. Every keystroke calls `onChange`, React updates state, re-renders the component, and the input displays the new value from state. This round-trip gives you complete programmatic control: validation, formatting, and disabling are all straightforward. An uncontrolled input stores its value in the DOM and is read via a ref. Uncontrolled inputs are simpler for quick forms but harder to validate synchronously. React recommends controlled components for most forms because they integrate naturally with state-driven logic such as enabling a submit button only when all fields are valid. The `onChange` event for ``, `
Result

Related Resources

React Reference
Complete tag & property list
React How-To Guides
Step-by-step practical guides
React Exercises
Practice what you've learned

More in React

Previous
Handling onClick and Synthetic Events
Next
Keyboard, Focus, and Other Event Types