生命周期函数:某一时刻组件会自动调用执行的函数
render也是
initialization(初始化)
constructor里
mounting(挂载)
componentWIllMount(){//在组件即将挂载到页面上时执行
}
//接下来render(){
}
conponentDidMount(){//挂载到页面之后自动执行
}
updation
componentWillReceiveProps(){//一个组件要从父组件接收参数
//只要父组件render函数被执行,子组件这个生命周期函数就会被执行
//如果组件第一次存在父组件中 不会执行 之前已经存在时会执行
}
shouldComponentUpdate(){
return true/false;(更新或不更新)
}
componentDidUpdate(){//组件更新完成之后执行
}
unmounting
componentWillUnmount