想问下我的代码哪里写的有问题,为什么num增加到10之后会出现抖动现象?相关代码importReact,{useState}from'react';exportdefaultfunctionExample(){const[num,setNum]=useState(0);setInterval(()=>{setNum(num+1)},1000);return(Clickme{num});}
相关代码importReact,{useState}from'react';exportdefaultfunctionExample(){const[num,setNum]=useState(0);setInterval(()=>{setNum(num+1)},1000);return(Clickme{num});}
importReact,{useState}from'react';exportdefaultfunctionExample(){const[num,setNum]=useState(0);setInterval(()=>{setNum(num+1)},1000);return(Clickme{num});}
exportdefaultfunctionExample(){const[num,setNum]=useState(0);setInterval(()=>{setNum(num+1)},1000);return(Clickme{num});}
const[num,setNum]=useState(0);setInterval(()=>{setNum(num+1)},1000);return(Clickme{num});}
setInterval(()=>{setNum(num+1)},1000);return(Clickme{num});}
setNum(num+1)},1000);return(Clickme{num});}
},1000);return(Clickme{num});}
return(Clickme{num});}
Clickme{num});}
Clickme{num}
);}
}
墨色风雨
相关分类