Skip to content

Commit

Permalink
Merge pull request #48 from smithki/smithki/fix-interval-for-strict-mode
Browse files Browse the repository at this point in the history
Fix `useInterval` for strict mode
  • Loading branch information
smithki authored May 19, 2023
2 parents 5a6082f + fe00f7c commit f0742c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hooks/use-interval/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ export function useInterval(effect: EffectCallback, deps: DependencyList, interv
}, [...deps]);

useEffect(() => {
const id = setTimeout(() => {
const id = setInterval(() => {
triggerInterval();
}, interval);
return () => clearTimeout(id);
return () => clearInterval(id);
}, [triggerInterval, interval]);

const clear = useCallbackConst(() => {
Expand Down

0 comments on commit f0742c9

Please sign in to comment.