use-timeout
A react-hook for accessing setTimeout without constantly resetting.
Install
yarn add @flaque/use-timeout
Usage
const [setTimeoutHook, clearTimeoutHook] = useTimeout();
setTimeoutHook(() => {
console.log("It's been 10000 miliseconds!");
}, 10000);
// ...
clearTimeoutHook(); // Stops the timeout before it happens