When would you choose a controlled or uncontrolled form input?
Understand the idea, explain it in your own words and use the rubric to find your next learning gap.
The idea behind the question
A controlled input gets its current value from React state and reports edits through an event handler. An uncontrolled input keeps its current value in the DOM, which can be read when needed.
A search field needs live validation, while a simple upload form only needs its values when the user submits.
A practical way to learn it
Build a labelled search input with controlled state, then implement an uncontrolled version that reads FormData on submit. Compare when each value becomes available.
Open React project studioThe related tool opens separately; your interview answer stays here. Written practice is self-guided, without automatic code grading.
Build an explanation you understand
- State what the concept does in plain language.
- Apply it to the example and make your assumptions explicit.
- Explain a trade-off, failure case and how you would test it.
- Distinguish your actual experience from a proposed approach.
How would you explain it?
Single-question timers reset on refresh. Full mock sessions can resume from this browser.
Strengthen your explanation
Compare reasoning, not identical wording. Reference answers describe a possible approach; replace hypothetical statements with truthful details from your own work.
One way to answer
I would decide who needs to own the current value. Controlled state is useful for live validation, dependent fields and reflecting changes elsewhere in the UI. For a simple form, an uncontrolled input with a default value and form submission may need less state. I would not switch an input between undefined and a controlled string after mounting. In either approach I would label fields, preserve user edits, handle reset deliberately and validate again at the server boundary. I would measure performance before optimizing away straightforward state.
What a strong explanation should cover
Tick only the points your own answer addresses. This is self-assessment, not AI scoring.
0 / 3 points self-reportedWatch out for
- Assuming an uncontrolled field needs no validation.
Now go one level deeper
- How would a late network response avoid overwriting current edits?
- How would you reset a file input?
Further reading
Further-reading links support learning; the reference is Sukoaa-authored, not an official employer answer key.