componentWillMount和componentDidMount的区别


1、componentWillMount  将要装载,在render之前调用;

      componentDidMount,(装载完成),在render之后调用

2、componentWillMount  每一个组件render之前立即调用;

      componentDidMount  render之后并不会立即调用,而是所有的子组件都render完之后才可以调用

3、componentWillMount  可以在服务端被调用,也可以在浏览器端被调用;

      componentDidMount  只能在浏览器端被调用,在服务器端使用react的时候不会被调用


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM