@vergiss/chooks
Version:
React hooks library
12 lines (10 loc) • 328 B
JavaScript
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 };