我正在尝试使用链接将数据传递到新页面,这样做我使用了以下代码。
<Link
className="option"
to={{
pathname: this.state.pathname,
state: id
}}
>
<span className="color-primary"> <button style={{ color: "white" }}
className="transaction-button"><i className="material-icons" style={{ fontSize: "18px" }}>sync_alt</i> Transaction</button>
</span>
</Link>
在路由的页面中,我尝试通过以下代码处理数据。
console.log(this.props)
输出是一个空对象。
{}
两个页面都是类组件