useStep
Custom hook that manages and navigates between steps in a multi-step process.
Installation
npx sse-tool add use-step
npm install sse-hooks
Usage
import { useStep } from "./{hooks file}";
const [
currentStep,
{
goToNextStep,
goToPrevStep,
reset,
canGoToNextStep,
canGoToPrevStep,
setStep,
},
] = useStep(3);
// Access and use the current step and provided helper functions.
import { useStep } from "sse-hooks";
const [
currentStep,
{
goToNextStep,
goToPrevStep,
reset,
canGoToNextStep,
canGoToPrevStep,
setStep,
},
] = useStep(3);
// Access and use the current step and provided helper functions.
API
Parameters
| Name | Type | Description |
|---|---|---|
| maxStep | number | The maximum step in the process. |
Return Value
Returns any.
An tuple containing the current step and helper functions for navigating steps.