文章详情页
javascript - react-router 4.0版本怎么实现以前onEnter的效果
浏览:190日期: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. Java IO流-InputStream是抽象类,也能调方法?(如图)2. html5 - Android混合开发3. android - 如何将viewpager的图片与状态栏沉侵4. java - ajax成功到后台不知道为什么一直回调失败函数5. javascript - app中集成轻量级富文本编辑器?6. javascript - hexo可以配置文章文件名为随机数么?7. 在介绍Node.js的相关资料中,$ npm install express中的$代表什么?8. html5 - vue-cli 装好了 新建项目的好了,找不到项目是怎么回事?9. mysqli更新不了数据10. phpstudy8.1没集成mysql-front
排行榜

网公网安备