通过页面之间的数据反应
我有eventData
,我需要从第A页传递到B。这是我的代码:
function eCE(eventData) {
history.push({
pathname: '/ece',
state: eventData
})
})
此功能在按钮单击上触发,因此它传递eventData
通过该功能。现在,我需要将eventData
发送到下一页,我可以通过调用/ece
来获取。但是,我试图在另一页上抓住状态
这样的:
const { state } = this.props.location
console.log(state)
它不起作用,而我得到的错误是:
TypeError: undefined has no properties
不确定在这里做什么。感谢帮助!
I have eventData
which I need to pass from page A to B. Here's my code:
function eCE(eventData) {
history.push({
pathname: '/ece',
state: eventData
})
})
This function gets triggered on button click, so it passed eventData
through to the function. Now I need to send eventData
through to the next page, in which I would get to by calling /ece
. However, I am trying to grab the state
on the other page like so:
const { state } = this.props.location
console.log(state)
it isn't working, and the error I get is:
TypeError: undefined has no properties
not to sure what to do here. appreciate the help !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在第1页:
在第2页中:
In page 1:
In page 2: