文章详情页
javascript - react-router 4.0版本怎么实现以前onEnter的效果
浏览:120日期: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容器呢SSH为什么连不通呢?2. 关docker hub上有些镜像的tag被标记““This image has vulnerabilities””3. docker网络端口映射,没有方便点的操作方法么?4. nignx - docker内nginx 80端口被占用5. debian - docker依赖的aufs-tools源码哪里可以找到啊?6. 前端 - ng-view不能加载进模板7. android clickablespan获取选中内容8. angular.js - angular内容过长展开收起效果9. python - from ..xxxx import xxxx到底是什么意思呢?10. angular.js - ng-grid 和tabset一起用时,grid width默认特别小
排行榜
