hooks-belt
Version:
A comprehensive collection of useful React hooks for common use cases
21 lines • 685 B
TypeScript
/**
* A hook that debounces a value or function execution.
* Useful for delaying expensive operations like API calls or search inputs.
*
* @param value - The value to debounce
* @param delay - The delay in milliseconds (default: 500ms)
* @returns The debounced value
*
* @example
* ```tsx
* const [searchTerm, setSearchTerm] = useState('')
* const debouncedSearchTerm = useDebounce(searchTerm, 300)
*
* useEffect(() => {
* // This will only run after the user stops typing for 300ms
* searchAPI(debouncedSearchTerm)
* }, [debouncedSearchTerm])
* ```
*/
export declare function useDebounce<T>(value: T, delay?: number): T;
//# sourceMappingURL=useDebounce.d.ts.map