@modern-kit/react
Version:
27 lines (24 loc) • 869 B
TypeScript
import { UseStepProps, useStep } from '../useStep/index.js';
import { SetStateAction } from 'react';
interface StorageOptions {
key: string;
type: 'localStorage' | 'sessionStorage';
}
interface UseStepWithInitialState<T> extends UseStepProps {
initialState: T;
storageOptions?: StorageOptions;
}
interface UseStepWithoutInitialState extends UseStepProps {
storageOptions?: StorageOptions;
}
declare function useStepState<T>({ initialState, ...props }: UseStepWithInitialState<T>): ReturnType<typeof useStep> & {
state: T;
setState: (newState: SetStateAction<T>) => void;
clearState: () => void;
};
declare function useStepState<T>(props: UseStepWithoutInitialState): ReturnType<typeof useStep> & {
state: T | null;
setState: (newState: SetStateAction<T | null>) => void;
clearState: () => void;
};
export { useStepState };