Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 578 Bytes

use-throttled-callback.mdx

File metadata and controls

21 lines (15 loc) · 578 Bytes

import { HooksDemos } from '@docs/demos'; import { Layout } from '@/layout'; import { MDX_DATA } from '@/mdx';

export default Layout(MDX_DATA.useThrottledCallback);

Usage

useThrottledCallback accepts a function and a wait time in milliseconds. It returns a throttled version of the function that will only be called at most once every wait milliseconds.

Definition

function useThrottledCallback<T extends (...args: any[]) => any>(
  callback: T,
  wait: number
): (...args: Parameters<T>) => void;