React學習筆記

react的生命週期

安裝:創建組件的實例將其插入DOM時,將按以下順序調用這些方法:
**constructor()
static getDerivedStateFromProps()
render()
componentDidMount()**
更新:props or state的更改可能導致更新。重新呈現組件時,將按以下順序調用這些方法:
static getDerivedStateFromProps()
shouldComponentUpdate()
render()
getSnapshotBeforeUpdate()
componentDidUpdate()
卸載:從DOM中刪除組件時調用此方法。
componentWillUnmount()

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章