@react-cmpt/use-throttle
Version:
The throttled value / function hook for react
14 lines (13 loc) • 459 B
TypeScript
import type { ThrottleFnOptions, ControlFunctions } from "./useThrottleFn";
export interface ThrottleOptions<T> extends ThrottleFnOptions {
/** The function to customize comparisons. */
customizer?: (left: T, right: T) => boolean;
}
/**
* useThrottle
*
* @param value
* @param wait number @default 0
* @param options object
*/
export default function useThrottle<T>(value: T, wait?: number, options?: ThrottleOptions<T>): [T, ControlFunctions];