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