Debouncing is a programming technique that helps to improve the performance of web applications by limiting the frequency of function calls. In thi...
For further actions, you may consider blocking this person and/or reporting abuse
I liked the other use cases. I usually only think in search inputs, but submit buttons should probably also be debounced.
Thanks !
Thanks this is very usefull
Thanks for your feedback!
Nice one
Thanks!
Welcome!
Nice article!!
does (...args) passed into the return function in debounce() represent the args in debounce(searchData, 3000) when called in debouncedSearchData?
that represent the arguments passed in the main function (in this case it is
searchData()
). To keep the things simple, I have not used any arguments in the functionsearchData()
.Thanks very insightfull bro
Thanks for your feedback!
Love the explanation. Great article.
Thanks @ricardo
Really easy and simple explanation!
I use the following approach, it's also the same:
Nice one !
This doesn't work for me for some reason.
Basicallt it repeatedly calls the "myFunc" function whenever I enter a key but with a delay of 3000 milliseconds.
Any idea? TIA!
Hi, I've had a similar problem before. You could use a
useRef
when you initializedebounced
to prevent the function run on every keystroke.This problem happens because every time you type, the component rerenders and creates a new instance of debounced. That's why it seems
clearTimeout(timer)
was not working as expected.Hope this helps!
Thanks Raffi, I learned something new today !
You could also achieve the one time initialisation like this:
checkout this, it might help you
geeksforgeeks.org/implement-search...
Сongratulations 🥳! Your article hit the top posts for the week - dev.to/fruntend/top-10-posts-for-f...
Keep it up 👍
Nice explanation. Here's my favorive demo comparing debouncing and throttling: web.archive.org/web/20180324022838...
Thanks!
nice explanation with examples
Nice breakdown. I can't wait to apply this! 😎
Thanks !
Thanks!