title: React redirects to home page on page refresh
body: <p>When a user refresh current page, react redirects it to home page. How do I prevent this? On force refresh page url should not change. I have tried HashRouter also, but no luck. can someone please suggest me what I am doing wrong ?</p>
  
  <p>Versions that I am using</p>
  
  <pre><code>"react": "^16.11.0",
  "react-dom": "^16.12.0",
  "react-router-dom": "^5.1.2",
  </code></pre>
  
  <p>index.js</p>
  
  <pre><code>ReactDOM.render(&lt;App /&gt;, document.getElementById('root')); 
  </code></pre>
  
  <p>App.js</p>
  
  <pre><code>import { BrowserRouter as Router } from 'react-router-dom';
  import BaseRouter from './routes';
  import CustomLayout from './containers/Layout';
  import { Provider } from "react-redux";
  import store from "./store";
  
  class App extends Component {
    render() {
      return (
        &lt;React.Fragment&gt;
          &lt;Provider store={store}&gt;
            &lt;Router&gt;
              &lt;CustomLayout {...this.props}&gt;
                &lt;BaseRouter /&gt;
              &lt;/CustomLayout&gt;
            &lt;/Router&gt;
  
          &lt;/Provider&gt;
        &lt;/React.Fragment&gt;
      );
    }
  }
  </code></pre>
  
  <p>here is part of routes.js</p>
  
  <pre><code>        &lt;React.Fragment&gt;
              {!token ? &lt;Redirect to='/login/' /&gt; :
                  &lt;Switch&gt;
                      &lt;Route exact path='/' component={HomePage} /&gt;
                      &lt;Route exact path='/customers/' component={Customers} /&gt;
                      &lt;Route exact path='/some-route/' component={someRoute} /&gt;
                      &lt;Route component={Page404} /&gt;
                  &lt;/Switch&gt;
              }
          &lt;/React.Fragment&gt;
  </code></pre>