文章详情页
javascript - react-router 4.0版本怎么实现以前onEnter的效果
浏览:171日期: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. javascript - c#如何向js传值2. docker gitlab 如何git clone?3. dockerfile - [docker build image失败- npm install]4. java - mybatis怎么实现在数据库中有就修改,没有就添加5. node.js - nodejs和前端JavaScript 字符串处理结果不一样是什么原因?6. docker绑定了nginx端口 外部访问不到7. javascript - npm run build后调用api返回index.html8. node.js - mongoDB使用$gte的问题9. 我在centos容器里安装docker,也就是在容器里安装容器,报错了?10. java中关于直接插入排序遇到的问题。
排行榜
