title: React Router redirect rendering a blank screen
body: <p>Currently having a small issue with ReactJS and the routing. I currently want my app to redirect back to the login screen if a token does not exist. The app should zero access to the other pages. If a user tries to input a url to redirect it without a valid token, it should default back to the login page.</p>
  
  <p>My code is as follows at present.</p>
  
  <pre><code>import { BrowserRouter, Route, Redirect, Switch } from 'react-router-dom';
          ...
  
    render() {
      const token = localStorage.getItem('access_token');
  
      return (
        &lt;BrowserRouter&gt;
          {!token ? &lt;Route render={() =&gt; &lt;Redirect push to="/" /&gt;} /&gt; :
          &lt;Switch&gt;
            &lt;Route exact path="/" component={Login} /&gt;
            &lt;Route exact path="/validate" component={ValidateLoginContainer} /&gt;
            &lt;Route exact path="/home" component={Landing} /&gt;
            &lt;Route exact path="/non-arrivals" component={NonArrivals} /&gt;
            &lt;Route exact path="/due-in-summary" component={DueInSummary} /&gt;
            &lt;Route exact path="/due-in-forecast" component={DueInForecastDetail} /&gt;
            &lt;Route exact path="/hourly-arrivals-departures" component={HourlyArrivalsDepartures} /&gt;
            &lt;Route exact path="/overstays" component={Overstays} /&gt;
          &lt;/Switch&gt;
        }
        &lt;/BrowserRouter&gt;
      );
    }
  </code></pre>
  
  <p>Trouble is it redirects fine, but renders a blank screen.</p>
  
  <p>Update code, still same error:</p>
  
  <pre><code>  &lt;BrowserRouter&gt;
      &lt;Switch&gt;
        &lt;Route render={() =&gt; {
              if (!token) {
                return &lt;Redirect push to="/" /&gt;;
              }
                 return &lt;Redirect push to="/home" /&gt;;
             }}
        /&gt;
  
        &lt;Redirect exact from="/" to="/home" /&gt;
        &lt;Route exact path="/" component={Login} /&gt;
        &lt;Route exact path="/validate" component={ValidateLoginContainer} /&gt;
        &lt;Route exact path="/home" component={Landing} /&gt;
        &lt;Route exact path="/non-arrivals" component={NonArrivals} /&gt;
        &lt;Route exact path="/due-in-summary" component={DueInSummary} /&gt;
        &lt;Route exact path="/due-in-forecast" component={DueInForecastDetail} /&gt;
        &lt;Route exact path="/hourly-arrivals-departures" component={HourlyArrivalsDepartures} /&gt;
        &lt;Route exact path="/overstays" component={Overstays} /&gt;
      &lt;/Switch&gt;
    &lt;/BrowserRouter&gt;
  </code></pre>