@ehsaneha/react-debounce
Version:
useDebounce is a custom React hook that delays invoking a function until a specified time has passed since the last call, ideal for handling user input like search fields.
10 lines (9 loc) • 353 B
TypeScript
/**
* useDebounce
* Calls the provided function after the user stops triggering it for `delay` ms.
*
* @param callback Function to run after debounce delay
* @param delay Delay in ms
* @returns A debounced version of the function
*/
export declare function useDebounce<T extends (...args: any[]) => void>(callback: T, delay: number): T;