react-router-dom 手动控制路由跳转
2017-08-10 17:00
826 查看
基于 react-router 4.0 版本,我们想要通过 JS 手动控制路由跳转,分三步:
第一步:引入 propTypes
const PropTypes = require('prop-types');
第二步:定义context 的router属性
BottomNavigationExampleSimple.contextTypes = { router: PropTypes.object }
第三步:控制跳转
handleClick= () => { this.context.router.history.replace('/index') };
相关文章推荐
- react-router v4如何使用history控制路由跳转详解
- react-router JS 控制路由跳转实例
- react-router JS 控制路由跳转(转载)
- 使用react-router-dom优雅的实现页面(路由)跳转, 而且保持当前页面状态
- react-router v4 使用 history 控制路由跳转
- react-router 路由控制页面跳转
- 通过一个用户管理实例学习路由react-router-dom知识
- 试着用React写项目-利用react-router解决跳转路由等问题(二)
- ReactJs Router 路由地址跳转方式带参数
- 试着用React写项目-利用react-router解决跳转路由等问题(一)
- 试着用React写项目-利用react-router解决跳转路由等问题(一)
- 试着用React写项目-利用react-router解决跳转路由等问题(一)
- React从react-router路由上做登陆验证控制的方法
- 试着用React写项目-利用react-router解决跳转路由等问题(二)
- react路由的使用方法以及通过路由如何传参传递私有属性--【基于最新版本的react-router-dom(4.2.2)】
- 试着用React写项目-利用react-router解决跳转路由等问题(三)
- React学习(三)——Router路由的使用和页面跳转
- 试着用React写项目-利用react-router解决跳转路由等问题(二)
- 试着用React写项目-利用react-router解决跳转路由等问题(二)
- React第三方组件1(路由管理之Router的使用②多层级跳转及重定向)