react-random-interval-hook
v0.1.4
Published
Make an interval with random time delay specified with min and max delay between each call.
Downloads
32
Readme
Random Interval Hook
Make an interval with random time delay specified with min and max delay between each call.
Installation
Using npm:
npm install react-random-interval-hookUsing yarn:
yarn add react-random-interval-hook Exmaple
import useRandomInterval from "react-random-interval-hook";
const interval = useRandomInterval((stop) => {
// do what you want
if (stopCondition) {
stop();
}
}, 1000, 2000); // interval between 1000 and 2000 msstop method also returns by the hook, you can stop interval manually like this.
if(stopCondition)
interval.stop();License
MIT
