Tiny utility (16 lines) to debounce your functions using requestAnimationFrame.

This means that your function will be called on the first available animation frame. If you use your function for updating visual information, you can use this package to debounce it - this way you won't make any unnecessary updates.

It has no dependencies and is written in TypeScript, so types are provided by default. It also has a React hook wrapper - use-debounce-animation-frame.

For more information you can check out the npm package or check out the source in GitHub.