It's a debounce react hook, which takes two parameter
- Function to be debounced
- Duration time
-
First Install the package
npm install react-debounce-func
-
Import and call
import {useDebounce} from 'react-debounce-func' export default function App(){ const handleEvent=(...)=>{ // .... } const debouncedHandleEvent = useDebounce(handleEvent, 1000) // Call the debouncedHandleEvent function (with parameter if handleEvent have) in any where you want return ( <> </> ) }
If you liked the project, I will appreciate if you leave a star. 🌟😊
Developed by Shajid