title: Page content is not loading after redirect - React web app
body: <p>I'm having a problem when trying to redirect using react-router-dom's Redirect.
  After the redirect, although the url in the address bar is correct, no content is loaded. It will only load after I refresh the page.</p>
  <p>I'm using a customized Route component because I need a isPrivate property to tell when the access to the page is restricted in order to do the redirect.</p>
  <p>this is my src/routes/index.js:</p>
  <pre><code>import React from 'react';
  import { Switch } from 'react-router-dom';
  import Route from './Route';
  
  import SignIn from '../pages/SignIn';
  
  import Dashboard from '../pages/Dashboard';
  
  export default function Routes() {
    return (
      &lt;Switch&gt;
        &lt;Route path=&quot;/&quot; exact component={SignIn} /&gt;
  
        &lt;Route path=&quot;/dashboard&quot; component={Dashboard} isPrivate /&gt;
      &lt;/Switch&gt;
    );
  }
  </code></pre>
  <p>this is my src/routes/Route.js:</p>
  <pre><code>import React from 'react';
  import { Route, Redirect } from 'react-router-dom';
  
  export default function RouteWrapper({
    component: Component,
    isPrivate,
    ...rest
  }) {
    const signed = false;
  
    if (!signed &amp;&amp; isPrivate) {
      return &lt;Redirect to=&quot;/&quot; /&gt;;
    }
  
    if (signed &amp;&amp; !isPrivate) {
      return &lt;Redirect to=&quot;/dashboard&quot; /&gt;;
    }
  
    return &lt;Route {...rest} component={Component} /&gt;;
  }
  </code></pre>
  <p>and this is src/App.js:</p>
  <pre><code>import React from 'react';
  import { Router } from 'react-router-dom';
  
  import history from './services/history';
  import Routes from './routes';
  
  function App() {
    return (
      &lt;Router history={history}&gt;
        &lt;Routes /&gt;
      &lt;/Router&gt;
    );
  }
  
  export default App;
  </code></pre>
  <p>I also noticed by inspecting the React components tree in the browser that it doesn't load the component tree completely when after the redirect, as in the following images:
  <a href="https://i.stack.imgur.com/kgXzO.png" rel="nofollow noreferrer">after redirect</a>
  and
  <a href="https://i.stack.imgur.com/qcA0w.png" rel="nofollow noreferrer">after reload or just regular load</a></p>
  <p>How can I make the page display correctly after the redirect? Any help would be appreciated</p>