Multi-step wizard state

Hooks & State — Advanced React challenge.

Build a 3-step signup wizard (Account Info → Profile Details → Review & Submit) using useReducer to manage the current step and all collected form data together. Next is guarded per step — you can't advance without filling in required fields — and going Back never loses what you already typed.

Requirements

Signature

function wizardReducer(state: { step: number; formData: object }, action): { step: number; formData: object }
function SignupWizard({ onComplete: (formData: object) => void }): JSX.Element

Example

wizardReducer({ step: 1, formData: { email: "", name: "", bio: "" } }, { type: "UPDATE_FIELD", payload: { field: "email", value: "a@b.com" } })
// ⇒ { step: 1, formData: { email: "a@b.com", name: "", bio: "" } }

Constraints

🏷️ Get 20% OFF on Yearly & Lifetime plans — use code 🏷️ Get 20% OFF on Yearly & Lifetime plans — use code 🏷️ Get 20% OFF on Yearly & Lifetime plans — use code 🏷️ Get 20% OFF on Yearly & Lifetime plans — use code 🏷️ Get 20% OFF on Yearly & Lifetime plans — use code 🏷️ Get 20% OFF on Yearly & Lifetime plans — use code
Loading workspace…