title: How to get current location from react-router?
body: <p>I am trying to drive my application's navigation from its state. Here's my use case:</p>
  
  <pre><code>Given the user is on the Login page
  When the application state changes to isLoggedIn
  Then the application should navigate to the Dashboard page
  </code></pre>
  
  <p>Here's my current implementation which works:</p>
  
  <pre><code>if (browserHistory.getCurrentLocation().pathname === '/login' &amp;&amp; store.isLoggedIn) {
      browserHistory.push('/dashboard');
  }
  </code></pre>
  
  <p>Unfortunately going through react-router docs and issues, I understand that <code>browserHistory.getCurrentLocation()</code> is not an official API and it should not be used. Is there a recommended way to do this?</p>
  
  <p>P.S. This code is running outside a React component, so I cannot use <code>this.props.location.pathname</code></p>