@reactutils/use-delayed-queue
v1.0.0
Published
A custom hook for queuing and executing functions in order with a specified timeout.
Downloads
3
Maintainers
Readme
@reactutils/use-delayed-queue
A custom hook for queuing and executing functions in order with a specified timeout.
Installation
npm install @reactutils/use-delayed-queue
# or
yarn add @reactutils/use-delayed-queue
Usage:
import useQueue from '@reactutils/use-delayed-queue';
function MyComponent() {
const { addToQueue } = useQueue();
const fn1 = () => {
console.log('Function 1 executed');
};
const fn2 = () => {
console.log('Function 2 executed');
};
addToQueue(fn1);
addToQueue(fn2);
return <div>My Component</div>;
}