@supunlakmal/hooks
Version:
A collection of reusable React hooks
11 lines (10 loc) • 601 B
TypeScript
/**
* A hook that fetches data like useFetch but debounces the request trigger.
* Useful for cases like search inputs where you don't want to fetch on every keystroke.
*
* @param initialUrl The URL to fetch initially. Can be changed later.
* @param options Options for the fetch request (standard RequestInit).
* @param delay The debounce delay in milliseconds.
* @returns The state and methods returned by the underlying useFetch hook (typed as any).
*/
export declare function useDebouncedFetch<T = any>(initialUrl: string | undefined, options: RequestInit | undefined, delay: number): any;