react-debounce-effect
v1.0.0
Published
React use effect hook but with debounce
Downloads
1
Readme
react-debounce-effect
React use effect hook but with debounce
Install
npm install react-debounce-effect
Usage
import React from "react"
import useDebounceEffect from 'react-debounce-effect'
const callback = React.useCallback(() => {
// do something
}, [])
useDebounceEffect(callback, 600)
API
Parameters
callback
type (...args: any[]) => void
This is the function that will be called when the timeout occurs. Make sure you memoize the function declaration using React.useCallback
ms
type number
the number of milliseconds that the debounce will occurs