title: Route open as a full page instead of opening in same page
body: <p>I am using react router for a SPA Dashboard. I have these two routes(<strong>Routes.js</strong>) in dashboard right now. Also, a separate route in <strong>App.js</strong> for landing page.</p>
  <p>Now it works fine as expected when it loads and when I click different routes. For example, When I click customers route(in sidebar), it open the customers section on the same page in right side. But, when I refresh the customers page <code>localhost:5000/customers</code>, now it opens as a separate page. How can I solve this.</p>
  <p>I tried debugging it but still no luck.
  Here's an example : <a href="https://github.com/gouravthakur39/MRE" rel="nofollow noreferrer">https://github.com/gouravthakur39/MRE</a>
  Unfortunately can't reproduce it in code sandbox</p>
  <p><strong>Routes.js</strong></p>
  <pre><code>import React from &quot;react&quot;;
  import { Route, Switch } from &quot;react-router-dom&quot;;
  
  import Dashboard from &quot;../pages/Dashboard&quot;;
  import Customers from &quot;../pages/Customers&quot;;
  
  const Routes = () =&gt; {
    return (
      
      &lt;Switch&gt;
        &lt;Route path=&quot;/home&quot; exact component={Dashboard} /&gt;
        &lt;Route path=&quot;/customers&quot; exact component={Customers} /&gt;
      &lt;/Switch&gt;
    
    );
  };
  
  export default Routes;
  
  </code></pre>
  <p><strong>Part of App.js</strong></p>
  <pre><code>import { Fragment } from &quot;react&quot;;
  import { BrowserRouter, Switch, Route } from &quot;react-router-dom&quot;;
  import PrivateRoute from &quot;./private/PrivateRoute&quot;;
  
  import Landing from &quot;./pages/Landing&quot;;
  import Home from &quot;./pages/Home&quot;;
  import Customers from &quot;./pages/Customers&quot;;
  
  function App() {
    return (
      &lt;Fragment&gt;
        &lt;div className=&quot;App&quot;&gt;
          &lt;BrowserRouter&gt;
            &lt;Switch&gt;
              &lt;Route exact path=&quot;/&quot; component={Landing} /&gt;
              &lt;PrivateRoute exact path=&quot;/home&quot; component={Home} /&gt;
              &lt;PrivateRoute exact path=&quot;/customers&quot; component={Customers} /&gt;
            &lt;/Switch&gt;
          &lt;/BrowserRouter&gt;
        &lt;/div&gt;
      &lt;/Fragment&gt;
    );
  }
  
  export default App;
  
  </code></pre>