看完就忘这种病折磨着我,让我无法高效率学习,痛不欲生,苦不堪言!但是,酸酸甜甜就是我,我有我方法。看完就忘那我就看完就记!
react生命周期宏观梳理
mount(挂载)
-
constructor()——初始化props和state -
componentWillMount()——即将插入,我马上要运行render啦 -
render()——将render函数中return的内容渲染到浏览器页面上 -
componentDidMount()——插入进去之后,我要做啥?
update(更新)
-
componentWillReceiveProps(nextProps)——我要读取props了 -
shouldComponentUpdate(nextProps,nextState)——请问要不要跟新组件?(true/false) -
componentWillUpdate()——我要更新组件了 -
render()——更新! -
componentDidUpdate()——更新完毕了!
unmount(移除)
-
componentWillUnmount()——我要狗带了!
react生命周期中各个函数具体介绍
补充:这是我的新文章