refactor: debounce.jsx to typescript and moving it to Hooks

This commit is contained in:
mannilakash committed 2026-02-09 12:38:39 -05:00
1 parent 07b0483352
commit e75606aad3
4 files changed
+31 -20

No files matched your search

-18
View File
@@ -1,18 +0,0 @@
import { useState, useEffect } from "react";
const useDebounce = (value, delay) => {
const [debouncedValue, setDebouncedValue] = useState(value);
useEffect(() => {
const handler = setTimeout(() => {
setDebouncedValue(value);
}, delay);
return () => {
clearTimeout(handler);
};
}, [value, delay]);
return debouncedValue;
};
export default useDebounce;