生命周期(1)

==> mounting(一次)

- constructor----------------(初始化数据使用)

- componentWillMount ------ 挂载之前(做动画)

- render ------------------第一次渲染(第一次渲染时要处理的逻辑)

- componentDidMount ------挂载之后(请求数据,拿到真实的dom)


==> updating

- shouldComponentUpdate----- 性能优化,如果写了就必须返回一个布尔值,默认为true,当为false的时候updation阶段停止

- componentWillUpdate -------- 数据更新之前

- componentWillReceiveProps ----- 父组件数据发生改变的时候触发

- componentDidUpdate ---------- 数据更新之后


==> unmounting

- componentWillUnmount -------- 组件销毁时调用

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。