mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 22:26:57 +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);
|
const savedCallback = useRef(fn);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
savedCallback.current = fn;
|
savedCallback.current = fn;
|
||||||
}, [deps]);
|
}, [fn, deps]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!immediate || delay === null || delay === false) return;
|
if (!immediate || delay === null || delay === false) return;
|
||||||
|
|
Loading…
Reference in a new issue