12 2021 档案

摘要:1.useState的参数(初始值),只在第一次有效 可以把第一次render前执行的代码放入其中 const instance = useRef(null); useState(()=>{ instance.current = 'initial value'; }); 2.useState里数据必 阅读全文
posted @ 2021-12-08 16:15 HQL97 阅读(47) 评论(0) 推荐(0)
摘要:useState import {useState} from 'react' function App(){ const [count,setCount] = useState(0); return( <div> {count} <button onClick={()=>{setCount(cou 阅读全文
posted @ 2021-12-08 14:49 HQL97 阅读(43) 评论(0) 推荐(0)