mcd mcd - 1 year ago 875
React JSX Question

React-Router open Link in new tab

Is there a way to get React Router to open a link in new tab? I tried this and it did not work.

<Link to="chart" target="_blank" query={{test: this.props.test}} >Test</Link>

It's possible to fluff it by adding something like
to the Link like what I have above, but there would be a console error.


Answer Source

I think Link component does not have the props for it.

You can have alternative way by create a tag and use the makeHref method of Navigation mixin to create your url

<a target='_blank' href={this.makeHref(routeConsts.CHECK_DOMAIN, {},
   { realm: userStore.getState().realms[0].name })}>
        Share this link to your webmaster
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download