
获得徽章 0
react的生命周期和父子组件的加载顺序
组件初始化 Mounting
组件运行时 Updating
组件卸载时 Unmounting
react的生命周期在16版前后有更改
父子组件加载和更新顺序和vue差不多,都是父组件先进入子组件完成后才会挂载完成父组件
mountComponent负责管理生命周期中的mounting阶段的方法调用
mountComponent本质上是通过递归渲染内容的,由于递归的特性,父组件的componentWillMount在其子组件的componentWillMount之前调用,而父组件的componentDidMount在其子组件的componentDidMount之后调用
updateComponent负责管理生命周期中的updating阶段的方法调用
updateComponent本质上是通过递归渲染内容的,由于递归的特性,父组件的componentWillUpdate在其子组件的componentWillUpdate之前调用,而父组件的componentDidUpdate在其子组件的componentDidUpdate之后调用
展开评论点赞