React · Junior · Question 20 of 75

What is a controlled input?

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).

Further reading

Problem with a question

React · Junior · question 20

Test yourself

Take the React · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz