Debounce and Throttle
Purpose
Used to prevent from the event has triggered for many times due to user behavior
E.g: user press the same button for several times in a second to fetch the data which may affect the performance
Debounce
The event will be triggered when the event is not be called in the specific time interval
Throttle
The numbers of event triggered is limited not more than once in every time interval
Difference
Debounce is to execute the latest function of the repeated function call in the time interval
Throttle is to execute the earliest function of repeated function in time interval
Last updated
Was this helpful?