react-use
react-use copied to clipboard
Add Generic Fn for useDebounce
For useDebounce hook add type parameter for returned Function.
Example:
const useDebounce = <F extends (...args: any[]) => any>(
func: F,
wait: number = 0,
): F => {
return useMemo<F>(() => debounce(func, wait), [func, wait]);
};