UNPKG

@vergiss/chooks

Version:
12 lines (10 loc) 328 B
import { useRef } from 'react'; import { debounce } from '../../utils/tools'; function useDebounce(fn, delay, thisValue) { var fnRef = useRef(fn); fnRef.current = fn; var debounced = debounce(fnRef.current, delay, thisValue); var debounceRef = useRef(debounced); return debounceRef.current; } export { useDebounce };