文章详情页
javascript - react-router 4.0版本怎么实现以前onEnter的效果
浏览:226日期: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. docker镜像push报错2. golang - 用IDE看docker源码时的小问题3. docker - 如何修改运行中容器的配置4. docker绑定了nginx端口 外部访问不到5. 为什么我ping不通我的docker容器呢???6. angular.js - angular内容过长展开收起效果7. boot2docker无法启动8. javascript - 移动端 点击弹出遮罩层 加断点调试就行 不加断点就不行9. docker网络端口映射,没有方便点的操作方法么?10. css3 - IE浏览器下,一个元素设置overflow:auto后,出现下拉滚动条,拖动滚动条图片会移动,但文字不移动
排行榜

网公网安备