lndsld

Home > @lndsld/react-hooks > useThrottledCallback

useThrottledCallback() function

Throttle callback

Reduce frequency of callback invocations

Signature:

declare function useThrottledCallback<P extends unknown[]>(callback: EventCallback<P>, timeout: number): EventCallback<P>;

Parameters

Parameter Type Description
callback EventCallback<P> callback to throttle
timeout number min time between callback invocations

Returns:

EventCallback<P>

throttled callback