We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3795f57 + 8393e4a commit 0127c2dCopy full SHA for 0127c2d
src/hooks/useInterval.js
@@ -1,11 +1,11 @@
1
import { useEffect, useRef } from 'react';
2
3
export default function useInterval(callback, delay) {
4
- const callbacRef = useRef();
+ const callbackRef = useRef();
5
6
// update callback function with current render callback that has access to latest props and state
7
useEffect(() => {
8
- callbacRef.current = callback;
+ callbackRef.current = callback;
9
});
10
11
@@ -14,7 +14,7 @@ export default function useInterval(callback, delay) {
14
}
15
16
const interval = setInterval(() => {
17
- callbacRef.current && callbacRef.current();
+ callbackRef.current && callbackRef.current();
18
}, delay);
19
return () => clearInterval(interval);
20
}, [delay]);
0 commit comments