1.挂载时 constructor
2.render React 将新调用的 render函数返回的树与旧版本的树进行比较,这一步是决定如何更新 DOM 的必要步骤,然后进行 diff 比较,更新 DOM树
3.渲染完成 componentDidMount ajax请求
4.销毁 componentWillUnmount
不常用的生命周期方法
1.shouldComponentUpdate() //更新拦截
2.static getDerivedStateFromProps()
3.getSnapshotBeforeUpdate()
4.static getDerivedStateFromError()
5.componentDidCatch() //错误渲染
初次渲染 constructor =》 render =》 componentDidMount
更新渲染 (props setState forceUpdatae) =》 render =》 componentDidUpdate