文章详情页
javascript - react-router 4.0版本怎么实现以前onEnter的效果
浏览:148日期: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. node.js - vue2 的npm run dev 卡死... 网页无法打开. 8080端口没有被占用...2. phpstady在win10上运行3. vim - docker中新的ubuntu12.04镜像,运行vi提示,找不到命名.4. 用PHP怎么在微信公众号里使用模板信息,公众号还未做开发?5. index.php错误,求指点6. 微信无法扫描phpqrcode生成的二维码7. javascript - 百度echarts图表如何修改8. node.js - vue-cll+sass 样式不出来 已经npm install sass、 sass-loader了9. python - 在ubuntu下安装scrapy过程遇到的问题10. python2.7 - django 无法连接redis
排行榜
