文章詳情頁
javascript - react-router 4.0版本怎么實現以前onEnter的效果
瀏覽:233日期: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. 關docker hub上有些鏡像的tag被標記““This image has vulnerabilities””2. docker鏡像push報錯3. phpstudy8.1沒集成mysql-front4. Docker for Mac 創建的dnsmasq容器連不上/不工作的問題5. node.js - mongodb查找子對象的名稱為某個值的對象的方法6. javascript - 在 model里定義的 引用表模型時,model為undefined。7. 利用IPMI遠程安裝centos報錯!8. 運行python程序時出現“應用程序發生異常”的內存錯誤?9. html5和Flash對抗是什么情況?10. 前端 - @media query 使用出現的問題?
排行榜

網公網安備