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

前端 未结 10 1103
你的背包
你的背包 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:13

    Add on info to get query parameters.

    const queryParams = new URLSearchParams(this.props.location.search);
    console.log('assuming query param is id', queryParams.get('id');
    

    For more info about URLSearchParams check this link URLSearchParams

提交回复
热议问题