react入门笔记七 (组件的生命周期)

生命周期分三个状态

mounting(组件挂载阶段)

updating(组件更新)

unmounting(组件移除)

props与state

生命周期分四个阶段

创建阶段

实例化阶段

getInitialState

componentWillMount

render

componentDidMount

更新状态

componentWillReceiveProps

shouldComponentUpdate

componentWillUpdate

render

componentDidUpdate

销毁阶段

compoentWillUnmount(即将销毁)

生命周期执行顺序

组件第一次创建时

组件创建并更新

组件销毁时

猜你喜欢

转载自blog.csdn.net/qq_38052995/article/details/83895990