将状态添加到“推送” React Router?

时间:2019-12-04 00:15:00

标签: reactjs react-router react-router-v4

我正在尝试使用React Router 4将状态添加到我的“推送”请求中。

我看到了很多示例,但是当我尝试执行此操作时,我想检查“状态”的组件未定义。

我的理解是我所需要的全部

props.routingStore.history.push({pathname :fullUrl,  state: { detail: props.item.id}});

那我愿意

 console.log(this.props.location.state, 'state')

我的组件上有@withRouter。

编辑

history: {length: 35, action: "POP", location: {…}, createHref: ƒ, push: ƒ, …}

location:
hash: ""
key: "r7jyux"
pathname: "/members/18/results"
search: ""
state: undefined
__proto__: Object


match:
isExact: true
params: {category: "18"}
path: "/members/:category/results"
url: "/members/18/results"

0 个答案:

没有答案