Skip to content

Commit

Permalink
Merge pull request #276 from Pranav-yadav/patch-1
Browse files Browse the repository at this point in the history
chore: rename `handler` → `timeoutID`
  • Loading branch information
elias-garcia authored Apr 3, 2023
2 parents 7c97457 + 3ea4119 commit 9dc2669
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hooks/use-debounce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ export function useDebounce<T>(value: T, delay: number): T {
const [debouncedValue, setDebouncedValue] = useState<T>(value);

useEffect(() => {
const handler = setTimeout(() => {
const timeoutID = setTimeout(() => {
setDebouncedValue(value);
}, delay);

return () => {
clearTimeout(handler);
clearTimeout(timeoutID);
};
}, [value, delay]);

Expand Down

0 comments on commit 9dc2669

Please sign in to comment.