rooks
Version:
Collection of awesome react hooks
18 lines (17 loc) • 462 B
TypeScript
/**
* useQueueState
* Manages a queue with react hooks.
* @param initialList Initial value of the list
* @returns The list and controls to modify the queue
* @see https://rooks.vercel.app/docs/hooks/useQueueState
*/
declare function useQueueState<T>(initialList: T[]): [
T[],
{
dequeue: () => T | undefined;
enqueue: (item: T) => number;
length: number;
peek: () => T | undefined;
}
];
export { useQueueState };