How to pass params with history.push/Link/Redirect in react-router v4?

前端 未结 10 938
你的背包
你的背包 2020-11-22 04:27

How can we pass parameter with this.props.history.push(\'/page\') in React-Router v4?

.then(response => {
       var r = this;
        if (re         


        
10条回答
  •  攒了一身酷
    2020-11-22 05:06

    you can use,

    this.props.history.push("/template", { ...response }) or this.props.history.push("/template", { response: response })

    then you can access the parsed data from /template component by following code,

    const state = this.props.location.state

    Read more about React Session History Management

提交回复
热议问题