DEV Community


Discussion on: Debouncing and Throttling

tomdohnal profile image
Tom Dohnal

What would make you decide to use one over the other?

shifaligupta profile image
shifaligupta Author

That totally depends on scenario we need to use.
For example,

  • We can throttle a button click event, if we do not want the user to spam by clicking the button frequently.
  • We can debounce mouse movement, if we are displaying the location coordinates of the mouse pointer as it is much better to show the coordinates once the user reached the desired location.