2016-08-24 155 views
0

react-router: ^2.0.0阵营路由器:合并查询

我有,比方说,这条路目前:

http://localhost:8000/feed?type=topics 

什么是增加一个属性来查询正确的方式?说,&offset=18

而我该如何正确更新查询中只有这个特定的属性?

我是否必须从this.props.location组装分离件的整个路径,参数和现有查询?

我发现了很多以前版本的建议,但没有为当前。

另外,有没有很好的文档react-router某处?回购中的文档不足。

回答

2

这里是QuerySupport

的文档只需要更新查询对象 history.push({ pathname: '/the/path', query: { the: 'query' } }); 您可以使用link太 <Link to={{ pathname: '/user/bob', query: { showAge: true } }} activeClassName="active">Bob With Query Params</Link>