title: There is a better way to redirect from a url to another in ReactJS?
body: <p>If a user access 'mysyte.com/app', I want to redirect him to 'mysyte.com/app/login' changing the url in the browser.</p>
  
  <p>I've managed to do this with the following code:</p>
  
  <pre><code>import React    from "react";
  import ReactDOM from "react-dom";
  import { BrowserRouter, Route, Switch, Redirect } from 'react-router-dom';
  import Login from "./login/login"
  
  ReactDOM.render(
      &lt;BrowserRouter&gt;
          &lt;Switch&gt;
              &lt;Route path="/app/login" component={Login}/&gt;
              &lt;Route path="/app" render={ () =&gt; &lt;Redirect push to="/app/login" /&gt; } /&gt;
          &lt;/Switch&gt;
      &lt;/BrowserRouter&gt;,
      document.getElementById("app")
  )
  </code></pre>
  
  <p>As I am in my first week of React, I'm wondering if there is a better way to do this.</p>
  
  <p>Thanks in advance.</p>