import _ from 'lodash'; interface Options extends _.DebounceSettings { wait: number; } type Debounce unknown> = _.DebouncedFunc; /** * Custom hook for debouncing functions inside components * @see https://lodash.com/docs/#debounce * @example * export default () => { * const ref = useRef(); * const [txt, setTxt] = useState(""); * const onChange = useDebounce((value: string)=> { * // component might unmount before callback of debounce * ref.current && setText(value); * }, {wait: 250, maxWait: 1000, leading: true}); * return (<>

{txt}

) * } */ export declare const useDebounce: unknown>(func: T, opt: Options, deps?: unknown[]) => Debounce; export default useDebounce;