useQueue
- This is a hook that provides the
queuedata structure..
Features
- It provides the
queueas anarray, along with thefirstandlastelements and the totalsizeof the queue. - It also includes functions to
add,remove, andclearvalues.
Types
const useQueue: <T>(initialValue?: T[]) => {
queue: T[];
first: T;
last: T;
size: number;
add: (value: T) => T;
remove: () => null;
clear: () => never[];
};