react之生命周期
react的生命周期主要分为:初始化,更新,卸载
初始化: componentDidMount是指组件被插入到DOM中时,触发
更新:componentDidUpdate是指传入新的props,或者调用setState()或者调用forceUpdate()时触发,componentDidUpdate(currentProps, currentState)接收两个两个参数.
currentProps:当前的props
currentState:当前的state
react的生命周期主要分为:初始化,更新,卸载
初始化: componentDidMount是指组件被插入到DOM中时,触发
更新:componentDidUpdate是指传入新的props,或者调用setState()或者调用forceUpdate()时触发,componentDidUpdate(currentProps, currentState)接收两个两个参数.
currentProps:当前的props
currentState:当前的state