Debouncing and Throttling

Pranav Bakare - Oct 22 - - Dev Community

Debouncing:

Delays the execution of a function until a certain period of inactivity has passed. It's useful when you want to ensure that a function only runs once after a user has stopped performing an action (e.g., typing in a search bar).

Throttling:

Limits the number of times a function can be executed over a period. It ensures the function runs at most once per specified interval, even if triggered multiple times (e.g., handling scroll events).

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .