← Questions
Multi-step form in React
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A coding interview question asked in Stripe's onsite coding (debug, integrate, build) round, last asked Sep 2025. It tests react, forms and state management.
Build a three-step form in React. Step 1 collects the user's basic details, step 2 their address, and step 3 shows everything for review and submits it.
What to build
- Validation on each step: required fields and simple format checks (for example an email address and a postal code). The user cannot move forward while the current step has errors.
- Navigation: Next and Back, and a way to jump to an earlier step; data entered stays when moving around.
- Disabled states: buttons are disabled when they cannot be used, including while a submit is in flight.
- Submitting: a loading state while the request runs, and a clear error message if it fails, with the data kept so the user can retry.
Unless you agree on a different interface with the interviewer, assume a submit(data): Promise<void> function that resolves on success and rejects with an error message on failure.
Clarifying questions
- Which fields does each step need, and which are required?
- Should errors show as the user types, when a field loses focus, or only on Next?
- Must progress survive a page reload?
- Are there accessibility requirements beyond the basics?
What a strong answer covers
- One source of truth for form data, the current step and the submit status, often a reducer, and why it beats many separate
useStatecalls here. - Step components that receive their slice of data and report changes, so adding a step is cheap.
- Validation as plain functions per step, reused for the Next button and on submit.
- Error messages tied to their fields with labels and ARIA, focus moved to the first error, and no double submit.
- Tests for blocked navigation, the loading state, a failed submit and a retry.
Follow-ups
- The form grows to 12 steps, some shown only for certain answers. How do you structure it?
- Save a draft so the user can come back later.
- Which performance concerns appear, and when would memoization or lazy loading of steps help?
Where it's asked
- Stripe · Onsite coding: debug, integrate, build · Last asked Sep 202560 min · Project editor with starter code and tests: fix bugs in an unfamiliar codebase, wire an external API spec into a service, or complete a skeleton in parts · Varies by session: some onsites have one AI-assisted session and an integration session without AI
What it tests
react · forms · state management
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
