为了账号安全,请及时绑定邮箱和手机立即绑定

react-router 4.0版本怎么实现以前onEnter的效果

react-router 4.0版本怎么实现以前onEnter的效果

胡说叔叔 2018-11-20 17:13:59
查看了官方文档,好像并没有说到这个
查看完整描述

1 回答

?
MM们

TA贡献1886条经验 获得超2个赞

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.


查看完整回答
反对 回复 2018-12-17
  • 1 回答
  • 0 关注
  • 966 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号