Skip to content

Instantly share code, notes, and snippets.

@showlovezz
Created May 5, 2020 01:03
Show Gist options
  • Save showlovezz/c03b3fc4fd06f7195ef4857cac8e1ff4 to your computer and use it in GitHub Desktop.
Save showlovezz/c03b3fc4fd06f7195ef4857cac8e1ff4 to your computer and use it in GitHub Desktop.
鼠年全馬鐵人挑戰 - React Hooks useEffect 3
useEffect(() => {
// 該 effect 僅在初次畫面渲染之後執行一次,相當於 componentDidMount
})
useEffect(() => {
// 該 effect 會在初次畫面渲染之後執行一次,同時當陣列內的 count 發生改變時也會執行,相當於 componentDidUpdate
}, [])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment