Custom hook to access Stepper context. Throws an error if used outside of Stepper provider.
StepperContextType - current step and navigation functions
import { useStepper } from "./useStepper";const StepInfo = () => { const { currentStep } = useStepper(); return <p>Current step: {currentStep}</p>;}; Copy
import { useStepper } from "./useStepper";const StepInfo = () => { const { currentStep } = useStepper(); return <p>Current step: {currentStep}</p>;};
export const useStepper = () => { const ctx = useContext(StepperContext) if (!ctx) throw new Error('useStepper must be used within a Stepper') return ctx} Copy
export const useStepper = () => { const ctx = useContext(StepperContext) if (!ctx) throw new Error('useStepper must be used within a Stepper') return ctx}
Custom hook to access Stepper context. Throws an error if used outside of Stepper provider.