Open Amybiubiu opened 3 years ago
记一些
react hooks
function Counter() { let [count, setCount] = useState(0) useEffect(() => { let id = setInterval(() => { setCount(count + 1) }, 1000) return () => clearInterval(id) }, []) return <h1>{count}</h1> } // https://overreacted.io/zh-hans/making-setinterval-declarative-with-react-hooks/
记一些
react hooks