UNPKG

@guruhotel/aura-hooks

Version:

🪝 Hooks library designed by the Guruhotel team for Aura UI

19 lines (18 loc) 468 B
export interface Actions<T> { set: (newPresent: T, checkpoint?: boolean) => void; reset: (newPresent: T) => void; undo: () => void; redo: () => void; canUndo: boolean; canRedo: boolean; } export interface State<T> { past: T[]; present: T; future: T[]; } declare type Options = { useCheckpoints?: boolean; }; export declare const useUndo: <T>(initialPresent: T, opts?: Options) => [State<T>, Actions<T>]; export default useUndo;