title: Programmatically Navigate using react-router
body: <p>I am developing an application in which I check if the user is not <code>loggedIn</code>. I have to display the login form, else <code>dispatch</code> an <code>action</code> that would change the route and load other component. Here is my code:</p>
  
  <pre class="lang-js prettyprint-override"><code>render() {
      if (isLoggedIn) {
          // dispatch an action to change the route
      }
      // return login component
      &lt;Login /&gt;
  }
  </code></pre>
  
  <p>How can I achieve this as I cannot change states inside the <code>render</code> function.</p>