How do you programmatically update query params in react-router?

后端 未结 8 2051
Happy的楠姐
Happy的楠姐 2020-11-29 21:41

I can\'t seem to find how to update query params with react-router without using . hashHistory.push(url) doesn\'t seem to register que

8条回答
  •  情书的邮戳
    2020-11-29 22:21

    Within the push method of hashHistory, you can specify your query parameters. For instance,

    history.push({
      pathname: '/dresses',
      search: '?color=blue'
    })
    

    or

    history.push('/dresses?color=blue')
    

    You can check out this repository for additional examples on using history

提交回复
热议问题