React · Junior · Question 20 of 75
What is a controlled input?
- ✓Correct answer: A field whose value is stored in state:
value+onChange - 2A field managed by the browser, with React reading its value via
ref - 3A field with the
requiredattribute, controlled by browser validation
Explanation
In a controlled field, state is the source of truth: value={text} and onChange={e => setText(e.target.value)}. This makes it easy to validate and format input on the fly. An uncontrolled field keeps its value in the DOM (defaultValue, read via ref or FormData).