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

Write a React component that loads a list of users from GET /api/users and shows distinct loading, success and error states, with a way to retry after a failure. It must behave correctly if the user navigates away while the request is still running. Use fetch or axios with hooks.

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?

MediumTechnical
74 practiced

You are building a searchable select (combobox) in React where the user types to filter a list of options. How do you make it fully operable by keyboard and usable with a screen reader, and how would you verify that both manually and with automated tests?

MediumTechnical
62 practiced

You are implementing a date field with a calendar popup for a booking form. What edge cases do you plan for before calling it done, and how do you handle each: users in different locales, typed rather than picked dates, invalid or out-of-range dates, keyboard and touch use, and a calendar that must render many dates?

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.

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.