为什么ref.current会重新触发渲染?
useEffect(() => {
ref.current = setInterval(() => {
setNum(num => num + 1)
}, 1000);
console.log(ref.current);
ref.current = 111;
console.log(ref.current);
setTimeout(() => {
ref.current = 2222
}, 5000)
}, []);
useEffect(() => {
console.log(num);
if (num > 10) {
console.log('num大于10', ref.current);
clearInterval(ref.current);
}
}, [num]);