淺入 React 生命週期相關(二)更新生命週期

更新階段分爲兩部分 父組件執行 render 或者調用 this.setState。 componentWillReceiveProps 大部分網上教程爲外部 props 發生改變才觸發 componentWillReceiveProps,其實不是,當父組件進入 render 時,無論子組件的 props 發沒發生改變,都會執行該生命週期函數。 函數參數有一個,爲 nextProps,爲將要新的
相關文章
相關標籤/搜索