React生命周期执行顺序

react

//组件加载的时候

constructor(props){

super(props)

this.state = {

msg:'张学友'

}

}

//组件将要挂载

componentWillMount(){

}

//数据渲染

render(){

}

//组件挂载完成的时候

componentDidMount(){

}

//组件数据更新的时候

//是否需要更新

shouldComponentUpdate(){

return true

}

//将要更新

componentWillUpdate(){

}

//更新完成

componentDidUpdate(){

}

render(){

}

//父组件里面改变props传值的时候出发

componentWillReceiveProps(){

}

//组件销毁

componentWillUnmount(){

}

  

以上是 React生命周期执行顺序 的全部内容, 来源链接: utcz.com/z/381902.html

回到顶部