« 回到主页

React生命周期

1 React生命周期流程图

image

2 组件在发生不同变化时会执行哪些生命周期方法?

image

3 每个生命周期方法适合做什么?

3.1 getDefaultProps()

3.2 getInitialState()

3.3 componentWillMount()

3.4 componentDidMount()

3.5 componentWillReceiveProps(nextProps)

3.6 shouldComponentUpdate(nextProps, nextState)

3.7 componentWillUpdate(nextProps, nextState)

« 回到主页