组件中, 点击按钮, 调用父元素中的的onAgeChange函数, 但是在父元素中这里我们setState的修改后的age和修改之前prevState中age状态值是一样的,age都是18, 所以App...在服务端渲染时 componentDidMount 是不会被调用的,只会调用componentWillMount.
2.在componentWillMount中, 我们一般会用来异步获取数据, 但是在新版生命周期中...在目前16.3之前的react版本中 ,react是同步渲染的, 在componentWillMount中接口调用,有可能不会触发界面渲染,而在componentDidMount中渲染一定会触发界面渲染...一定随后被调用
4.componentDidMount
这个方法在组件被mount后被立即调用....Provider 组件的 value prop 值发生变更时,其内部组件树中对应的 Consumer 组件会接收到新值并重新执行 children 函数。