相关疑难解决方法(0)

重定向到新选项卡时通过链接传递状态

情况 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.

reactjs react-router

10
推荐指数
2
解决办法
2万
查看次数

标签 统计

react-router ×1

reactjs ×1