react动态路由传值
1、动态路由配置
<Route path="/content/:aid" component={Content} />
2、对应的动态路由加载的组件里面获取传值
this.props.match.params.aid
跳转:<Link to={`/content/${value.aid}`}>{value.title}</Link>
react get传值
一步即可
//url模块来解析url地址 在react里面使用url模块需要安装url模块 cnpm install url --save
import url from ‘url‘;
var query=url.parse(this.props.location.search,true).query;
console.log(query)
1、获取 this.props.location.search
原文:https://www.cnblogs.com/duocaishenghuo/p/13898400.html