情况 1: 重定向到同一选项卡中的新路由。
<Link to={{ pathname: "/modify_items", state: { foo: "bar" } }} >
Run Code Online (Sandbox Code Playgroud)
当我输入console.log(this.props.location.state);状态时{ foo: "bar" },会打印出来。
情况2: 重定向到新选项卡中的新路线。
<Link to={{ pathname: "/modify_items", state: { foo: "bar" } }} target="_blank" >
Run Code Online (Sandbox Code Playgroud)
当我输入时,console.log(this.props.location.state);状态变为undefined.
My goal is to pass data to a new tab. Please guide me if there is any other way to achieve this in React.js. I just want to pass data to a new tab.