AK
Size: a a a
AK
YS
AI
AK
YS
YS
AI
AI
AI
AK
AK
YS
AK
AI
const [state, change] = useState();
const stateRef = useRef();
useEffect(() => {stateRef.current = state;}, [state]);
const doSmth = useCallback(() => stateRef.current...., [])
JD
AI
YS
AI
const [_, forceUpdate] = useState({});
const stateRef = useRef({
state: {},
doSmth() {
this.state = 'hello, world'
}
})
const changeValue = useCallback((value) => {
stateRef.doSmth(value);
forceUpdate()
})
AI
AI