lndsld

Home > @lndsld/react-hooks > useDebouncedCallback

useDebouncedCallback() function

Apply debounce to callback

If callback wasn’t invoked during specified time, last call will be invoked

Signature:

declare function useDebouncedCallback<P extends unknown[]>(callback: EventCallback<P>, delay?: number): EventCallback<P>;

Parameters

Parameter Type Description
callback EventCallback<P> callback to debounce
delay number (Optional) debounce time (if zero or undefined, debounce will not be applied)

Returns:

EventCallback<P>

debounced callback