title: React Router onEnter not working as intended
body: <p>I am building a basic react-login app for educational purposes and to authenticate a route I am using React-router's onEnter prop functionality</p>
  
  <pre><code>import axios from 'axios';    
  
  var Authentication = (nextState, replace, callback) =&gt; {
      axios.get('/api/getuser')
      .then((res) =&gt; {
          if(res.data != '') {
            replace('account/wall')
          }
          callback()
      })
      .catch((err) =&gt; {
          callback()
      })
  
  }
  
  export default (
    &lt;Route component={Root}  &gt;
        &lt;Route path='/' component={Home} onEnter={Authentication}/&gt;
        &lt;Route path='/login' component={Login} onEnter={Authentication}/&gt; 
        &lt;Route path='/signup' component={Registration} onEnter={Authentication}/&gt; 
        &lt;Route path='/account/wall' component={Wall}/&gt;
        &lt;Route path='*' component={Notfound} /&gt;
    &lt;/Route&gt;
  
  );
  </code></pre>
  
  <p>Everything is working as intended But it is beyond me why the router render the Home component for a blink second and THEN replace the route to <code>/account/wall</code> when I try <code>/</code> route after logging in?? Same thing happen if I try <code>/login</code> or <code>/signup</code> after logging in., Is there anyway to fix this behavior ?? </p>
  
  <p>I already tried to solve this by authenticating the user in componentWillMount method (which is not the react way i guess) by rendering empty <code>&lt;div&gt;</code> when checking for user but that also renders empty page for a blink second and not the correct way to do it. </p>
  
  <p>So I just want to render <code>/account/wall</code> if user is authenticated without any middleware renders. What can I do??</p>