Keep one schema for the whole form and validate each step against its slice, so the same rules run on the client and again on the server. Hold answers in a single object above the steps, drive the current step from the URL so back and forward work, and persist progress on step change. Validate on blur and on submit, and never trust client validation as the only gate.
Why interviewers ask this
Multi step forms surface a lot of design decisions at once: state placement, routing, validation strategy, persistence and accessibility. The interviewer wants to see that you think about the user pressing the browser back button, refreshing halfway through, and hitting a server side validation error on the final step. Weak answers keep everything in one giant useState and forget the URL entirely.
How to structure your answer
- Define one schema and derive per step validation from it.
- Say where the answers live and why.
- Put the step in the URL and explain what that fixes.
- Cover persistence, server validation and error handling on submit.
Example answer
I start with a single schema for the whole thing, then each step validates its own slice of it. That way there is one definition of what valid means, and I can run the exact same schema on the server, because client validation is a convenience and not a guarantee. The collected answers live in one object in a parent, or a small store if the steps are far apart in the tree, and each step gets its slice and a way to write back. The current step goes in the URL, which sounds like a detail but it fixes several things at once: back and forward work, someone can refresh without losing their place, and support can ask which URL they are on. I persist the draft on each step transition, usually to the server if the user is signed in and to storage if not. Validation runs on blur and again on next, and on final submit I handle server errors by mapping the field paths back to the right step and jumping the user there with focus on the offending input.
Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.
See how it worksFollow-up questions to expect
- How do you handle a validation error that only the server can detect?
- What do you do about a user who abandons at step three and returns a week later?
- How do you manage focus and announcements between steps for screen readers?
Related react developer questions
Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.
Predict my questions