[react] 说说react的生命周期有哪些?
Posted 前端小歌谣
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[react] 说说react的生命周期有哪些?相关的知识,希望对你有一定的参考价值。
[react] 说说react的生命周期有哪些?
装载阶段
组件第一次被渲染时的阶段,这一阶段相关的生命周期函数有:
constructor
componentWillMount
render
componentDidMount
更新阶段
如果组件中的 state 或者 props 发生了改变,React 就会更新该组件,此时会调用更新阶段中相关的生命周期函数:
componentWillReceiveProps
shouldComponentUpdate
componentWillUpdate
render
componentDidUpdate
卸载阶段
componentWillUnmount
个人简介
我是歌谣,欢迎和大家一起交流前后端知识。放弃很容易,
但坚持一定很酷。欢迎大家一起讨论
主目录
以上是关于[react] 说说react的生命周期有哪些?的主要内容,如果未能解决你的问题,请参考以下文章
JS每日一题: react的生命周期有哪些?有什么需要注意的地方?