useStep
Custom hook that manages and navigates between steps in a multi-step process.
Custom hook that manages and navigates between steps in a multi-step process.
Usage
import { useStep } from "@tilt-legal/cubitt-components/utilities/hooks";
const [currentStep, { goToNextStep, goToPrevStep, reset, canGoToNextStep, canGoToPrevStep, setStep }] = useStep(3);
// Access and use the current step and provided helper functions.API
Signature
declare function useStep(maxStep: number): [number, UseStepActions];Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
maxStep | number | The maximum step in the process. | - |
Return Value
| Value | Type | Description |
|---|---|---|
return | [number, UseStepActions] | An tuple containing the current step and helper functions for navigating steps. |