小白使用react——解决this.props.history.push无法跳转的问题
来源:互联网 发布:淘宝宝贝突然下架 编辑:程序博客网 时间:2024/06/04 01:25
场景:
一个组件中,含有ul展开数组的组件,在每一行中,都能点击相应的这一行,跳转到对应的页面。
也就是说,组件套组件,子组件中this.props.history.push无法工作。提示没有push这个函数。
因为这时的props中没有history这个属性。
解决办法:
在父组件中,传递一个history。
子组件中用history.push 就可以啦
参考资料:
https://segmentfault.com/a/1190000011137828
阅读全文
0 0
- 小白使用react——解决this.props.history.push无法跳转的问题
- React入门教程(三)—— this.props
- react——props
- React Native的this.props获取属性
- undefined is not an object (evaluating 'this.props.nav.push')的解决过程
- react使用props的原则
- react this.props.children
- react小提示:this.props.location.query.bar 获取URL的查询字符串
- react——传递 Props
- 解决 git 无法 push 的问题
- react native -- this.props.children
- React.js--this.props.children
- React list this.props.children
- React页面利用this.context.router.push跳转传参的接收方法
- StoryBoard使用push跳转不连线。(解决黑屏问题)
- 刚开始使用push遇到的小问题
- React Native入门基础——Props
- 解决Eclipse中使用Egit无法push to upstream的问题
- JS学习
- 使用Jena-TDB存储RDF本体、知识图谱文件
- web使用openoffice实现在线预览office文档
- opencv computer vison
- Android源码解析之singleTask launchMode
- 小白使用react——解决this.props.history.push无法跳转的问题
- Docker容器的生命周期管理
- BAT批处理 获取当前系统日期前一天的日期
- Hibernate(八)---管理Session
- JQuery的选择器对控件ID含有特殊字符的解决方法-涨姿势了!
- CEF3的使用说明
- Windows系统下使用维基百科中文语料训练Word2Vec词向量
- leetcode 410. Split Array Largest Sum 最小化最大数 + 一个很棒的二分搜索BinarySearch的做法
- react-router初