文章詳情頁
javascript - react-router 4.0版本怎么實現以前onEnter的效果
瀏覽:135日期:2023-02-18 15:49:01
問題描述
查看了官方文檔,好像并沒有說到這個
問題解答
回答1:React Router v3 provides onEnter, onUpdate, and onLeave methods. These were essentially recreating React’s lifecycle methods.
With v4, you should use the lifecycle methods of the component rendered by a <Route>. Instead of onEnter, you would use componentDidMount or componentWillMount. Where you would use onUpdate, you can use componentDidUpdate or componentWillUpdate (or possibly componentWillReceiveProps). onLeave can be replaced with componentWillUnmount.
標簽:
JavaScript
相關文章:
1. css3 - 這個右下角折角用css怎么畫出來?2. css3 - 沒明白盒子的height隨width的變化這段css是怎樣實現的?3. javascript - canvas 裁剪空白區域4. atom開始輸入!然后按tab只有空格出現沒有html格式出現5. javascript - 移動端自適應6. javascript - 在 model里定義的 引用表模型時,model為undefined。7. apache - 想把之前寫的單機版 windows 軟件改成網絡版,讓每個用戶可以注冊并登錄。類似 qq 的登陸,怎么架設服務器呢?8. android - 課程表點擊后浮動后邊透明可以左右滑動的界面是什么?9. python3.x - c++調用python310. java - 根據月份查詢多個表里的內容怎么實現好?
排行榜
