1.2.1 • Published 5 years ago
@flaque/use-timeout v1.2.1
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