React 生命周期函数

React 生命周期函数

Initialization (初始化) Mounting(挂载) Updation(更新) Unmounting()
setup componentWillMount props states componentWillUnmont(当这个组件即将被从页面中移除的时候,会被执行)
props render componentWillReceiveProps shouldComponentUpdate
state componentDidMount(组件被挂载到页面之后,自动被执行) shouldComponentUpdate(组件被更新之前,会自动被执行) componentWillUpdate
\ \ componentWillUpdate render \
\ \ render componentDidUpdate \
\ \ componentDidUpdate(组件更新完之后,执行) \ \

componentWillReceiveProps

  1. 一个组件要从父组件接受参数
  2. 只要父组件的 render 函数被重新执行,子组件的这个生命周期函数就会被执行

React 生命周期函数_第1张图片

React 生命周期函数_第2张图片

你可能感兴趣的:(React)