文章詳情頁
javascript - react-router 4.0版本怎么實現以前onEnter的效果
瀏覽:141日期: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 - 各位電腦上有多少個容器啊?容器一多,自己都搞混了,咋辦呢?2. docker start -a dockername 老是卡住,什么情況?3. docker容器呢SSH為什么連不通呢?4. Android listview checkbox 單選5. 關docker hub上有些鏡像的tag被標記““This image has vulnerabilities””6. Android TextView 或 ListView 加載過渡效果7. 爬蟲圖片 - 關于Python 爬蟲的問題8. python - thrift 返回 TSocket read 0 bytes 求助!!!!9. Python列表或者字典里面的中文如何處理?10. python - (初學者)代碼運行不起來,求指導,謝謝!
排行榜
