rooks
Version:
Essential React custom hooks ⚓ to super charge your components!
17 lines • 883 B
TypeScript
import type { UseUndoStateOptions, UseUndoStateReturnValue } from "../types/types";
import type { ExcludeFunction } from "../types/utils";
/**
* useUndoState hook
* Drop in replacement for useState hook but with undo functionality.
*
* @typedef UndoStateOptions
* @type {object}
* @property {number} maxSize - Maximum number of states to keep in the undo stack.
* @param {any} defaultValue - Default value to use for the state. This will be the first value in the undo stack.
* @param {UseUndoStateOptions} options - Options for the undo state. Currently takes the maxSize option.
* @returns {UseUndoStateReturnValue}
* @see https://rooks.vercel.app/docs/hooks/useUndoState
*/
declare const useUndoState: <T>(defaultValue: ExcludeFunction<T>, options?: UseUndoStateOptions) => UseUndoStateReturnValue<T>;
export { useUndoState };
//# sourceMappingURL=useUndoState.d.ts.map