johann1301s
johann1301s

Reputation: 534

React-router: How to manually invoke Link in new window?

I'm using connected react router, and i want to trigger an opening of a new window tab inside a function and not by a direct click on the Link component supplied by the router library.

I have read through the docs of reactrouter.com, but i have not been successful in finding a solution.

How can i trigger an opening of a new window tab inside a function, preferably using the react router library?

Upvotes: 0

Views: 262

Answers (1)

jacobfinch
jacobfinch

Reputation: 11

Not sure how you would with reactrouter but you could simply use the snippet below. React router is really built around the idea of Single Page Applications.

window.open(`${url}`, "_blank");

Upvotes: 1

Related Questions