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

ParameterTypeDescriptionDefault
maxStepnumberThe maximum step in the process.-

Return Value

ValueTypeDescription
return[number, UseStepActions]An tuple containing the current step and helper functions for navigating steps.

On this page