Salesforce Decode
Salesforcedecode
Back to questions
LWCIntermediatewizardstateux

Build wizard multi-step LWC with state management

Real World Scenario

Four-step onboarding wizard loses data when user navigates back and forth between steps.

Expected Answer

• Central @track wizardState object in parent container • Child steps emit events updating parent state not local only copies • Persist draft to localStorage or custom object optional • Validate step before next navigation • Progress indicator with completed step markers • Summary step reviewing all inputs before submit

Follow-Up Questions & Answers

Click to expand — each follow-up includes a direct, interview-ready answer

Main difference: use case and scale. Central @track wizardState object in parent container. Child steps emit events updating parent state not local only copies. Pick based on your integration pattern and team capability. Wizard state belongs in orchestrator parent—step components stay stateless where possible. Balance speed of delivery with maintainability.

Architect Perspective

Wizard state belongs in orchestrator parent—step components stay stateless where possible.