I want to build a new platform using [Next.js](https://nextjs.org/) ([React.js](https://reactjs.org/) and [React-router](https://reacttraining.com/react-router/web/guides/quick-start)). There will be a two spaces. One front-end for users and one for the owner to allow them manage all users. I want to split both areas into two subdomains, like this:

front.domain.com
panel.domain.com

React-router does not support sub-domain routing, so I tried to find another approach. I found something like that, but I am not sure that this is what I want. Please advice.

```
<BrowserRouter>
  <Route path="/" render={props => {
    const [subdomain] = window.location.hostname.split('.');
    if (subdomain === 'panel') return <PanelLayout {...props}/>;
    return <FrontLayout {...props}/>;
  }}/>
</BrowserRouter>

```