文章詳情頁(yè)
javascript - react-router 4.0版本怎么實(shí)現(xiàn)以前onEnter的效果
瀏覽:129日期:2023-02-18 15:49:01
問(wèn)題描述
查看了官方文檔,好像并沒(méi)有說(shuō)到這個(gè)
問(wèn)題解答
回答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.
標(biāo)簽:
JavaScript
上一條:javascript - 頁(yè)面加載慢,有什么優(yōu)化方案下一條:javascript - vue 子組件有個(gè)按鈕,點(diǎn)擊了要改變狀態(tài),這個(gè)狀態(tài)是父組件通過(guò)接口取的,就是要?jiǎng)討B(tài)改變接口的狀態(tài)
相關(guān)文章:
1. windows誤人子弟啊2. 冒昧問(wèn)一下,我這php代碼哪里出錯(cuò)了???3. MySQL主鍵沖突時(shí)的更新操作和替換操作在功能上有什么差別(如圖)4. python - linux怎么在每天的凌晨2點(diǎn)執(zhí)行一次這個(gè)log.py文件5. 數(shù)據(jù)庫(kù) - Mysql的存儲(chǔ)過(guò)程真的是個(gè)坑!求助下面的存儲(chǔ)過(guò)程哪里錯(cuò)啦,實(shí)在是找不到哪里的問(wèn)題了。6. 實(shí)現(xiàn)bing搜索工具urlAPI提交7. mysql優(yōu)化 - MySQL如何為配置表建立索引?8. 如何用筆記本上的apache做微信開(kāi)發(fā)的服務(wù)器9. 我在網(wǎng)址中輸入localhost/abc.php顯示的是not found是為什么呢?10. 關(guān)于mysql聯(lián)合查詢一對(duì)多的顯示結(jié)果問(wèn)題
排行榜

熱門標(biāo)簽