文章详情页
javascript - react-router 4.0版本怎么实现以前onEnter的效果
浏览:177日期: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. css3 - 一个关于CSS雪碧图的问题2. Docker for Mac 创建的dnsmasq容器连不上/不工作的问题3. docker-machine添加一个已有的docker主机问题4. redis编译报错:cannot find -lgcc_s5. docker镜像push报错6. 如何解决Centos下Docker服务启动无响应,且输入docker命令无响应?7. mac里的docker如何命令行开启呢?8. angular.js - 如何在指令里使用ng-click9. node.js - antdesign怎么集合react-redux对input控件进行初始化赋值10. wordpress - nginx 反代 Varnish 走 Https ,WP后台 ‘您没有足够的权限访问该页面。’
排行榜

网公网安备