@sjblurton/use-timeout
v0.1.3
Published
useTime takes 2 arguments, the first is the function you would like to run after the the delay, the second is the delay in milliseconds. It returns a object with clear, and rest functions to clear, or reset the timeout.
Downloads
9
Maintainers
Readme
useTimeout
useTime takes 2 arguments, the first is the function you would like to run after the the delay, the second is the delay in milliseconds. It returns a object with clear, and rest functions to clear, or reset the timeout.
To install the hook...
npm i @sjblurton/use-timeout
yarn add @sjblurton/use-timeout
To call the hook...
const { clear, reset } = useTimeout(() => callback(), 1000)
To clear timeout...
clear()
To reset timeout...
reset()
links
GitHub Repo: https://github.com/sjblurton/use-timeout NPM: https://www.npmjs.com/package/@sjblurton/use-timeout