react-router: how to get the previous route in onEnter handler?
<p>I'm trying to find a way to read the previous route/path when a user hits a new one, within the <code>onEnter</code> handler.</p>

<p>I have a React Router structured like so:</p>

<pre><code>    &lt;Router history={history}&gt;
      &lt;div className="index"&gt;
        &lt;Route
          path="/"
          component={ComposedAppComponent}
          onEnter={this.onEnterHandler.bind(this)}
        &gt;
          &lt;Route name="streamKey" path=":streamKey"&gt;
            &lt;Route name="articleUri" path="(**)" /&gt;
          &lt;/Route&gt;
        &lt;/Route&gt;
      &lt;/div&gt;
    &lt;/Router&gt;
</code></pre>

<p>the function, <code>onEnterHandler</code>, looks like so:</p>

<pre><code>  onEnterHandler(nextRouteState) {
    const { streamKey, splat } = nextRouteState.params;

    const nextPath = `/${streamKey}/${splat}`;
    const prevPath = // HOW DO I GET THE PREVIOUS PATH?
  }
</code></pre>

<p>I can't seem to find a way to read the previous route path the user was on... I need to make a comparison between the new route and previous one. Any input on how to approach this is much appreciated. :) </p>

<p>Cheers!</p>