Search code examples
mobxmobx-react

How to open route in a new tab using MobX State Router's RouterStore?


https://nareshbhatia.github.io/mobx-state-router/docs/api-router-store

Looking through their docs, I don't see any mention of how to open a route in a new tab. Does this mean that I must resort to javascript's window.open() API?


Solution

  • Opening up a new tab will unavoidably create a new history stack, so it doesn't matter how you go about opening it.

    You could use window.open() like you alluded to, or even an a tag with an attribute target set to _blank:

    <a target="_blank" href="/a-route">Open a route in a new tab</a>