use-debounce-coolhatguy
v1.1.4
Published
A starter for creating a new React hook
Downloads
3
Readme
useDebounceHook
coined by web dev simplified: https://www.youtube.com/c/WebDevSimplified
I decided to convert this into an npm package for accessability.
import:
import { useDebounce } from "use-debounce-coolhatguy"
arguements
1. callback
2. time in milliseconds
3. array of dependencies
explanation
Whenever the dependencies change the hook will wait for the time given the second arguement. If the dependencies change again in that time, the timer is reset. Once the array stops changing the callback will be run. This is perfect for search bars that use an api call because it stops the front end from exhausting the server.