文章详情页
javascript - react-router 4.0版本怎么实现以前onEnter的效果
浏览:58日期: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. dockerfile - 我用docker build的时候出现下边问题 麻烦帮我看一下3. angular.js - angularjs的自定义过滤器如何给文字加颜色?4. 关docker hub上有些镜像的tag被标记““This image has vulnerabilities””5. 请问怎么改变超链接字体的颜色?6. docker网络端口映射,没有方便点的操作方法么?7. angular.js - angular2 有什么cool的loading组件么?8. docker内创建jenkins访问另一个容器下的服务器问题9. java - 做数据库向手机端的推送要系统地学习哪些知识?求大神指点,谢谢!10. java编程思想第4版中文版的几处谬误?
排行榜
![docker-machine添加一个已有的docker主机问题](http://www.haobala.com/attached/image/news/202311/1028320972.png)