小知识,大挑战!本文正在参与“程序员必备小知识”创作活动
1、挂载阶段
调用方法:
constructor() //构造函数
componentWillMount()//将要被挂载
render()//渲染
componentDidMount()// 完成挂载
2、更新阶段
调用方法:
componentWillReceiveProps(nextProps) //作为子空间,在props改变时调用
shouldComponentUpdate(nextProps,nextState)//是否允许更新,返回boolean
componentWillUpdate(nextProps,nextState)//将要更新
render()//渲染
componentDidUpdate(prevProps,prevState)//完成更新
3、销毁阶段
调用方法: