UNPKG

beautiful-react-hooks

Version:

A collection of beautiful (and hopefully useful) React hooks to speed-up your components and hooks development

16 lines (15 loc) 728 B
/// <reference types="lodash" /> import { type DependencyList } from 'react'; import { type GenericFunction } from './shared/types'; export interface DebounceOptions { leading?: boolean | undefined; maxWait?: number | undefined; trailing?: boolean | undefined; } /** * Accepts a function and returns a new debounced yet memoized version of that same function that delays * its invoking by the defined time. * If time is not defined, its default value will be 250ms. */ declare const useDebouncedCallback: <TCallback extends GenericFunction>(fn: TCallback, dependencies?: DependencyList, wait?: number, options?: DebounceOptions) => import("lodash").DebouncedFunc<TCallback>; export default useDebouncedCallback;