DEV Community

Discussion on: Debouncing with React Hooks

Collapse
haraldson profile image
Hein Haraldson Berg • Edited on

Here’s my take on a lodash.debounce hook. I don’t see why the hook shouldn’t be more convenient to use, so I basically made a useState wrapper which updates the value immediately (a requirement for controlled inputs), and updates a signal, which is meant to be used in a useEffect’s dependency array, only whenever specified as per lodash.debounce’s docs.