mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 06:06:41 +01:00
Fix fn not refreshed in useInterval
This commit is contained in:
parent
5791338393
commit
afc13c0d7e
1 changed files with 1 additions and 1 deletions
|
@ -4,7 +4,7 @@ function useInterval(fn, delay, deps, immediate) {
|
|||
const savedCallback = useRef(fn);
|
||||
useEffect(() => {
|
||||
savedCallback.current = fn;
|
||||
}, [deps]);
|
||||
}, [fn, deps]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!immediate || delay === null || delay === false) return;
|
||||
|
|
Loading…
Reference in a new issue