diff --git a/src/lib/components/steppers/Stepper.component.tsx b/src/lib/components/steppers/Stepper.component.tsx index f2a433e72b..8a8744dcae 100644 --- a/src/lib/components/steppers/Stepper.component.tsx +++ b/src/lib/components/steppers/Stepper.component.tsx @@ -55,26 +55,27 @@ export const Stepper = ({ }: { steps: readonly [...Steps]; }) => { - const [currentStep, setCurrentStep] = useState(0); - const [stepProps, setStepProps] = useState>({}); + // const [currentStep, setCurrentStep] = useState(0); + const [stepProps, setStepProps] = useState<{ + step: number; + props: Record; + }>({ step: 0, props: {} }); const next = (props: Record) => { - setCurrentStep(currentStep + 1); - setStepProps(props); + setStepProps({ step: stepProps.step + 1, props }); }; const prev = (props: Record) => { - setCurrentStep(currentStep - 1); - setStepProps(props); + setStepProps({ step: stepProps.step - 1, props }); }; - const { Component } = steps[currentStep]; + const { Component } = steps[stepProps.step]; return ( { return { title: step.label,