React と React Native のスレ (481レス)
上下前次1-新
235: 2021/12/06(月)19:49 ID:56/uA2M5(1) AAS
function useMyHook() {
const [a, setA] = useState(0);
const [b, setB] = useState(0);
return {
foo: () => a+b,
bar: () => a-b,
};
}
function MyComp () {
const myhook = useMyHook();
useEffect(() => {
if (myhook.foo() > 100 && myhook.bar() < 20)
hoge();
}
}, [???]);
return <Aaaaa />;
???はどう書くのが正解?
推移的に依存してるのはa, bだがa、bには直接アクセスできない
上下前次1-新書関写板覧索設栞歴
あと 246 レスあります
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ
ぬこの手 ぬこTOP 0.005s