is there any way to accomplish the following without using a “hacky” solution?
It has to be done this way due to how I plan on using the stepper.
export interface StepperProps {
steps: StepData[];
nextStep: () => void;
prevStep: () => void;
}
export const Stepper = ({ steps, nextStep, prevStep }: StepperProps) => {
const [currentStep, setCurrentStep] = useState(1);
// when nextStep is called, pasoActual++
// when prevStep is called, pasoActual--
return "Not important right now";
};
I was able to do this by returning a different value with nextStep and prevStep every time they were called, however, there might be a better way to achieve this.