Files
NapCatQQ/.pnpm-store/v3/files/cd/aee24417d1cf780d42dcae51bb26a3a3faa81eaebeded891c2a8d1cb0fd15b686bddeddddd13ea0f42d81a1dfc86af0aaa4a7e67c4334d5eb1c5bbbe3d1e96
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

24 lines
565 B
Plaintext

// src/index.ts
import { useEffect, useRef } from "react";
var useUpdateEffect = (effect, deps) => {
const renderCycleRef = useRef(false);
const effectCycleRef = useRef(false);
useEffect(() => {
const isMounted = renderCycleRef.current;
const shouldRun = isMounted && effectCycleRef.current;
if (shouldRun) {
return effect();
}
effectCycleRef.current = true;
}, deps);
useEffect(() => {
renderCycleRef.current = true;
return () => {
renderCycleRef.current = false;
};
}, []);
};
export {
useUpdateEffect
};