1.1.4 • Published 4 years ago

use-debounce-coolhatguy v1.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

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.