Hacker News new | ask | show | jobs
by nsonha 1119 days ago
I saw `useDebounce` and thought "what the hell does debounce have anything to do with react render cycle?". When I check the code, `useDebounce` does... I don't even know what it does, delayed set state?

https://github.com/uidotdev/usehooks/blob/380e83fa267157832e...

1 comments

If you have state that changes too quickly (like the value of an input field), then you can use `useDebounce` to derive a state that only changes every `n` milliseconds.