文章详情页
javascript - react-router 4.0版本怎么实现以前onEnter的效果
浏览:260日期: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. 数组 - mysql 輸出到 php array 然後印出?2. python - 正则表达式匹配和原生字符的问题3. 数据结构 - java翻转链表是如何实现的?4. python - pymysql建立连接出错5. javascript - vue webpack打包问题6. nginx反向代理配置访问后台,基础问题?7. javascript - VUE 递归写的树状组件,怎么向外传递事件?8. javascript - 修改表单多选项时和后台同事配合的问题。9. CSS3中background-size的问题10. mysql - 订单表,我把它分成好几个,我要查询订单,怎么用一条sql语句高效查询
排行榜

网公网安备