文章详情页
javascript - react-router 4.0版本怎么实现以前onEnter的效果
浏览:249日期: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-machine添加一个已有的docker主机问题2. 为什么我ping不通我的docker容器呢???3. Nginx如何进行跨域配置,才能使用DELETE,PUT请求方法4. javascript - 使用echarts做一个横向的柱状图,但是数据超出坐标轴范围了怎么办?5. android.text.Html.fromHtml()无法解析<ol><li> </li></ol>应该怎么解决6. css3 - 有好的Blog的CSS样式吗?7. docker start -a dockername 老是卡住,什么情况?8. 在windows下安装docker Toolbox 启动Docker Quickstart Terminal 失败!9. java - 白盒加密源码或者库10. 我正在使用jsp / jstl / spring动态生成css和js如何将此结果放置在头部的链接标签中不在头部的脚本标签中
排行榜

网公网安备