web: rename events

This commit is contained in:
Carl-Gerhard Lindesvärd
2023-12-17 14:19:05 +01:00
parent fdb9b912d7
commit 4845cbf6f8
8 changed files with 44 additions and 4 deletions

View File

@@ -0,0 +1,14 @@
import { useEffect } from 'react';
import debounce from 'lodash.debounce';
export function useDebounceFn<T>(fn: T, ms = 500): T {
const debouncedFn = debounce(fn, ms);
useEffect(() => {
return () => {
debouncedFn.cancel();
};
});
return debouncedFn;
}