@mantine/hooks
Version:
A collection of 50+ hooks for state and UI management
17 lines (16 loc) • 467 B
TypeScript
export interface UseStateHistoryHandlers<T> {
set: (value: T) => void;
back: (steps?: number) => void;
forward: (steps?: number) => void;
reset: () => void;
}
export interface UseStateHistoryValue<T> {
history: T[];
current: number;
}
export type UseStateHistoryReturnValue<T> = [
T,
UseStateHistoryHandlers<T>,
UseStateHistoryValue<T>
];
export declare function useStateHistory<T>(initialValue: T): UseStateHistoryReturnValue<T>;