React生命周期函数

  React生命周期函数:组件加载前、组件加载完成、组件更新数据、组件销毁;触发的一系列的方法 ,这就是组件的生命周期函数

  组件加载时触发函数:constructor 、componentWillMount、 render 、componentDidMount

  组件数据更新时触发函数:shouldComponentUpdate、componentWillUpdate、render、componentDidUpdate

  父子组件传值时改变props值是触发函数:componentWillReceiveProps

  组件销毁时触发函数:componentWillUnmount

1.生命周期函数触发:刷新

一刷新页面 顺序:

constructor->componentWillMount  //组件将要挂载 触发的生命周期函数

->render //渲染 

-> componentDidMount   //组件挂载完成时触发生命周期函数

 2.生命周期函数:修改数据

修改数据 顺序:

shouldComponentUpdate 
->componentWillUpdate  //将要更新的时候触发 
->render 渲染 
->componentDidUpdate  //更新完成的时候触发

3.销毁仅触发componentWillReceiveProps

componentWillReceiveProps

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值