文章详情页
javascript - react-router 4.0版本怎么实现以前onEnter的效果
浏览:272日期: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 - 微信公号里采用七牛上传视频部分手机不能选择文件2. 关于python爬虫的问题3. MYSQL 运算的问题4. mysql sql where id in(25,12,87) 结果集如何用按照 25 12 87排序?5. Python, for-else, while-else是否造成了语义歧义 ( 增加心智负担 )?6. mysql多表查询7. python3.x - python多进程,不能在同一窗口吗8. javascript - js 对中文进行MD5加密和python结果不一样。9. pdo_mysql 值自增写法10. 存储过程 - Mysql时间参数 问题
排行榜

网公网安备