文章详情页
javascript - react-router 4.0版本怎么实现以前onEnter的效果
浏览:237日期: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. debian - docker依赖的aufs-tools源码哪里可以找到啊?2. docker安装后出现Cannot connect to the Docker daemon.3. docker - 各位电脑上有多少个容器啊?容器一多,自己都搞混了,咋办呢?4. docker-compose 为何找不到配置文件?5. 关docker hub上有些镜像的tag被标记““This image has vulnerabilities””6. angular.js - angular内容过长展开收起效果7. docker 下面创建的IMAGE 他们的 ID 一样?这个是怎么回事????8. angular.js使用$resource服务把数据存入mongodb的问题。9. macos - mac下docker如何设置代理10. docker网络端口映射,没有方便点的操作方法么?
排行榜

网公网安备