@dh-react-hooks/use-raf
v0.9.4
Published
react hooks for requestAnimationFrame
Downloads
223
Maintainers
Readme
@dh-react-hooks/use-raf
react hooks for handling requestAnimationFrame
Installation
npm i @dh-react-hooks/use-raf
Arguments
| props | type | required | default | description | | --- | --- | --- | --- | --- | | disable | boolean | false | false | disable to call requestAnimationFrame at the first time | | duration | number | false | undefined | duration time to call requestAnimationFrame in milliseconed. it not specify, callback will loop infinitely | | callback | function | true | undefined | callback function to requestAnimationFrame |
Way to Ride
- Common jS
const useRaf = require('@dh-react-hooks/use-raf')
const { isActive, start, stop } = useRaf.default({
disable,
duration,
callback
})
- ESM
import useRaf from '@dh-react-hooks/use-raf'
const { isActive, start, stop } = useRaf({
disable,
duration,
callback
})