title: React Router re-render route instead of re-render component
body: <p>I'm working on an app that is using React Router and I noticed that when my Redux store changes state that the router is re-rendering the component the current route refers to rather than re-rendering the route itself.</p>
  
  <p>To illustrate the problem; I have implemented a <code>PrivateRoute</code> that checks if a user is currently logged in. In it's most basic form it looks something like this:</p>
  
  <pre><code>const PrivateRoute = ({component: Component, ...rest}) =&gt; {
    return &lt;Route {...rest} render={(props) =&gt; {
      const state = store.getState()
  
      if (state.isAuthenticated) {
        return &lt;Component {...props}/&gt;
      }
      else {
        return &lt;Redirect to={{pathname: '/login'}}/
      }
    }}/&gt;
  })
  </code></pre>
  
  <p>This works great since I can now say something like this:</p>
  
  <pre><code>&lt;PrivateRoute path="/" component={HomePage}/&gt;
  </code></pre>
  
  <p>However, I noticed that when the state of <code>isAuthenticated</code> changes that React Router is calling the <code>render</code> method on the <code>HomePage</code> component rather than that it re-renders the route. This means that the application will only do the authentication check when a user goes from some page to the home page but once on the home page, the check is no longer performed. </p>
  
  <p>The only work around I have at the moment is to move the authentication check into the <code>render</code> function of the component (which is obviously not where it belongs).</p>
  
  <p>How can I make React Router re-render the route rather than re-render the component the route refers to when the state changes?</p>