
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 !
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()
.Love the explanation. Great article.
Thanks @ricardo
Thanks very insightfull bro
Thanks for your feedback!
Thanks this is very usefull
Thanks for your feedback!
Thanks!
Welcome!
Nice one
I use the following approach, it's also the same:
Nice one !
Really easy and simple explanation!
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...
for submit button isn't a commun case , because its event handler could set states to emty strings , and when inputs are empty the button should be disabled.
However fr search input it is very useful and debouncing become imperative
Nice explanation. Here's my favorive demo comparing debouncing and throttling: web.archive.org/web/20180324022838...
Thanks!
nice explanation with examples
Сongratulations 🥳! Your article hit the top posts for the week - dev.to/fruntend/top-10-posts-for-f...
Keep it up 👍
wonderfully explained 👏
Nice breakdown. I can't wait to apply this! 😎
Thanks for the nice article and good picture.
Nice. There's also this good blog post that gives some more advanced techniques around debouncing.
Thanks !
Thanks!
Thanks this is very useful 👍