Question 1 · forms · mid
What is the difference between a controlled and an uncontrolled input?
- A.Controlled inputs cannot be typed into
- B.Controlled inputs only work inside a <form>
- C.A controlled input's value comes from React state via value/onChange; an uncontrolled input keeps its own value in the DOM, read via a ref or form data
- D.Uncontrolled inputs are deprecated in React 18
Show answer
C. A controlled input's value comes from React state via value/onChange; an uncontrolled input keeps its own value in the DOM, read via a ref or form data
Controlled inputs make React state the single source of truth. Uncontrolled inputs use defaultValue and are read when needed, which is simpler for basic forms.