文章詳情頁
javascript - react-router 4.0版本怎么實現以前onEnter的效果
瀏覽:109日期: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. python - 能通過CAN控制一部普通的家用轎車嗎?2. 人工智能 - python 機器學習 醫療數據 怎么學3. python - beautifulsoup獲取網頁內容的問題4. c++ - 請問MySQL_Connection::isReadOnly 怎么解決?5. html5 - 只用CSS如何實現input框的寬度隨框里輸入的內容長短自動適應?6. mysql優化 - 關于mysql分區7. centos7 編譯安裝 Python 3.5.1 失敗8. mysql - 分庫分表、分區、讀寫分離 這些都是用在什么場景下 ,會帶來哪些效率或者其他方面的好處9. Python爬蟲如何爬取span和span中間的內容并分別存入字典里?10. python - Django內使用filter過濾時間,只認年份不認月份是怎么回事?
排行榜
