How to push to History in React Router v4?

后端 未结 21 2295
不思量自难忘°
不思量自难忘° 2020-11-22 00:27

In the current version of React Router (v3) I can accept a server response and use browserHistory.push to go to the appropriate response page. However, this isn

21条回答
  •  佛祖请我去吃肉
    2020-11-22 01:05

    React router V4 now allows the history prop to be used as below:

    this.props.history.push("/dummy",value)
    

    The value then can be accessed wherever the location prop is available as state:{value} not component state.

提交回复
热议问题