react组件生命周期分为三大部分:
1、挂载
constructor
componentWillMount
render
componentDidMount组件挂载完成可以请求后台数据
2、更新
componentReceiveProps,只在props更新时调用
shoudComponentUpdate(nextProps, nextState) 根据返回结果true/false决定要不要重新渲染,性能优化可以在这里做。
componentWillUpdate
render
componentDidUpdate
3、卸载
componentWillUnmount 此时可以清除定时器,取消发布订阅
原文地址:https://www.cnblogs.com/miasur/p/15159571.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。