前言

学习React,生命周期很重要,我们了解完生命周期的各个组件,对写高性能组件会有很大的帮助.

Ract生命周期

React 生命周期分为三种状态 1. 初始化 2.更新 3.销毁

React生命周期简单详细理解-LMLPHP

  • 初始化

1、getDefaultProps()

2、getInitialState()

3、componentWillMount()

4、 render()

5、componentDidMount()

  • 更新

6、componentWillReceiveProps(nextProps)

7、shouldComponentUpdate(nextProps, nextState)

8、componentWillUpdata(nextProps, nextState)

9、render()

10、componentDidUpdate()

  • 卸载

11、componentWillUnmount()

05-11 15:36
查看更多