React Curriculum

React Forms Interview Questions: Controlled Inputs

React forms interview questions are a staple of frontend machine coding interviews, where you build performant, accessible forms. You will be evaluated on your understanding of controlled input re-render overhead versus uncontrolled native form advantages.

Explore modern uncontrolled forms using native FormData, learn how to prevent the input cursor jump bug during async formatting, and integrate robust schema validation libraries like Zod while managing field-level dirty and touched states.

The section starts with controlled versus uncontrolled inputs, including why a controlled input's cursor jumps to the end when its value is transformed, then moves to uncontrolled forms read with FormData, which React 19 form actions build on. Schema validation with Zod keeps one source of truth for types and rules, and the last lesson covers file inputs and input masking, where neither pattern is enough on its own.

Interviewers use forms to test whether you understand React's rendering model in practice: when a keystroke should cause a re-render, where validation errors live, and how to keep an input accessible while it is being formatted.

React Forms Interview Questions: 4 lessons

Frequently asked questions

What is the difference between controlled and uncontrolled inputs in React?

A controlled input's value comes from React state and changes only through onChange, so React is the source of truth. An uncontrolled input keeps its own value in the DOM and you read it when you need it, through a ref or FormData. Controlled inputs make instant validation and formatting easy; uncontrolled ones re-render less.

Why does the cursor jump to the end of a controlled input?

When onChange transforms the value, for example uppercasing or masking it, React writes back a value that differs from what the browser holds, the DOM value is replaced and the caret moves to the end. Keep the transformation idempotent, or restore the selection range after the update.

Do I need a form library in React 19?

Not for simple forms: an uncontrolled form read with FormData in a form action avoids a re-render per keystroke and needs no library. For large forms with dependent fields and field-level validation, a form library with a Zod schema keeps the code manageable.