UNPKG

rooks

Version:

Collection of awesome react hooks

14 lines (13 loc) 530 B
type Callback<T> = (...args: T[]) => void; /** * useThrottle * Throttles a function with a timeout and ensures * that the callback function runs at most once in that duration * * @param callback The callback to throttle * @param timeout Throttle timeout * @returns [Callback, isReady] The throttled callback and if it is currently throttled * @see https://rooks.vercel.app/docs/hooks/useThrottle */ declare function useThrottle<T>(callback: Callback<T>, timeout?: number): [Callback<T>, boolean]; export { useThrottle };