rooks
Version:
Collection of awesome react hooks
21 lines (20 loc) • 536 B
TypeScript
/**
* useStackState
* @description Manages a stack with react hooks.
* @param initialList Initial value of the list
* @returns The list and controls to modify the stack
* @see https://rooks.vercel.app/docs/hooks/useStackState
*/
declare function useStackState<T>(initialList: T[]): [
T[],
{
clear: () => void;
isEmpty: () => boolean;
length: number;
peek: () => T | undefined;
pop: () => T | undefined;
push: (item: T) => number;
},
T[]
];
export { useStackState };