UI Component Implementation: Forms and States Questions

Implementing forms and the non-happy-path states of UI components in the browser. Covers form building (controlled and uncontrolled inputs, reusable form hooks tracking values, touched fields and errors, dynamic groups of repeating fields, multi-step flows, submit handling), client-side and server-side validation (inline errors, validation timing, cross-field rules, async validation such as username checks with stale-response handling, error summaries, mapping API error responses onto fields), and the states a component must handle: loading and pending, error and retry, empty results, disabled, error boundaries around a failing widget, and edge cases such as double submit, slow or failed networks, drafts preserved across failures, and unexpected input like pasted text or locale differences. Includes building custom inputs and widgets robustly: restricted numeric inputs, comboboxes and custom selects, and date fields with calendar popups, with labels, error association, focus management, announcing errors to assistive technology and keyboard operation. Excludes design-system library governance and tokens, optimistic-update and rollback logic in the client data layer, accessibility strategy as a design practice, and the state-management architecture of the whole application.

EasyTechnical
62 practiced

Build a numeric input component in React that only accepts whole numbers from 0 to 100 and passes a clean value to its parent. What do you do about pasted text, an empty field, a leading minus sign or decimal point, and the cursor jumping while the user types?

MediumTechnical
56 practiced

A form-heavy single-page app talks to an API that returns errors shaped like { error: { code: 'invalid_field', message: 'Invalid email', fields: { email: 'invalid_format' } } }. How do you turn those responses into what the user sees: per-field errors, form-level errors, translated text, and the difference between failures worth retrying and ones that are not? What do you do with server messages you do not want to show verbatim?

EasyTechnical
103 practiced

Explain the difference between controlled and uncontrolled form inputs in React: how each affects event handling, keeping state in sync and performance. Convert an input that uses a ref into a controlled one, and say when you would pick each approach.

MediumTechnical
79 practiced

Implement a custom select control in React: a button that opens a list of options, with the open state exposed to assistive technology, selection by keyboard, closing on Escape, and options announced by a screen reader. Show the key parts of the component.

MediumTechnical
114 practiced

You are implementing validation for a long signup form. When should each field validate (while typing, on blur, on submit), how and where do you show inline errors versus a summary at the top, and where should focus go after a failed submit? Give the rules you would implement and the trade-offs.

Unlock Full Question Bank

Get access to all 18 UI Component Implementation: Forms and States interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.