Multi-Step Onboarding Form
Modern web applications often require users to input complex information through a series of guided steps, rather than a single monolithic form. This approach, known as a multi-step form, significantly enhances user experience by breaking down complexity, reducing cognitive load, and providing clear progress indicators. For a STAFF-level candidate, demonstrating proficiency in building such a system from scratch, including robust state management and validation, is crucial.
In this problem, you will build a multi-step onboarding form for a hypothetical service. This form will collect personal details, address information, and provide a final review step before submission. The core challenge lies in managing form state across steps, implementing per-step validation, and ensuring a smooth user flow without relying on external form libraries.
Your task is to implement a responsive, multi-step form component in React/TypeScript with the following steps:
Step 1: Personal Details
Full Name (text input, required)Email (email input, required, must be a valid email format)Step 2: Address Details
Street Address (text input, required)City (text input, required)Zip Code (text input, required, must be 5 digits)Step 3: Review & Submit
For all steps, you must:
Next and Previous buttons).Next button if the current step's fields are invalid.<label>, type attributes for inputs) to ensure basic accessibility. Focus management is out of scope beyond standard browser behavior.Constraints
useState, useReducer, useCallback).localStorage, backend) is required.Loading editor...