React学习笔记

react的生命周期

安装:创建组件的实例将其插入DOM时,将按以下顺序调用这些方法:
**constructor()
static getDerivedStateFromProps()
render()
componentDidMount()**
更新:props or state的更改可能导致更新。重新呈现组件时,将按以下顺序调用这些方法:
static getDerivedStateFromProps()
shouldComponentUpdate()
render()
getSnapshotBeforeUpdate()
componentDidUpdate()
卸载:从DOM中删除组件时调用此方法。
componentWillUnmount()

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