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.
npm install @sjblurton/use-timeoutuseTime 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.
``bash
npm i @sjblurton/use-timeout
yarn add @sjblurton/use-timeout
`
`bash`
const { clear, reset } = useTimeout(() => callback(), 1000)
`bash`
clear()
`bash``
reset()
GitHub Repo:
https://github.com/sjblurton/use-timeout
NPM:
https://www.npmjs.com/package/@sjblurton/use-timeout