文章详情页
javascript - react-router 4.0版本怎么实现以前onEnter的效果
浏览:149日期: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. javascript 开发百度地图2. python socket 如何接收tcp/ip byte 格式的数据?3. python小白 问关于递归的问题4. python - 为什么用time.strftime格式化会用默认值?5. python - 为什么match匹配出来的结果是<_sre.SRE_Match object; span=(0, 54), match=’’>6. python - 如何在dataframe中删除某行当某列值为nan时?7. python - 如何用pandas处理分钟数据变成小时线?8. python - 这句是什么错误?9. python3.5 urllib.parse.unquote 乱码10. 【小白问题】这行python命令行程序是什么意思?
排行榜
