title: React Router v4 on change
body: <p>I am developing an ordinary React JS app and using a BrowserRouter. I need to know when the route changes and the only thing I found was to use the <a href="https://github.com/ReactTraining/history" rel="nofollow noreferrer">history package</a> by the same guys (react-training).</p>
  
  <p>Their example looks easy enough but does not work at all for me:</p>
  
  <pre><code>import createHistory from 'history/createBrowserHistory'
  const history = createHistory()
  
  console.log('a')
  history.listen((location, action) =&gt; {
      console.log(`The current URL is ${location.pathname}${location.search}${location.hash}`)
      console.log(`The last navigation action was ${action}`)
  })
  
  
  const A = props =&gt; &lt;div&gt;A &lt;NavLink to="/b"&gt;b&lt;/NavLink&gt;&lt;/div&gt;
  const B = props =&gt; &lt;div&gt;B &lt;NavLink to="/a"&gt;a&lt;/NavLink&gt;&lt;/div&gt;
  
  ReactDOM.render(
      &lt;BrowserRouter&gt;
          &lt;div&gt;
              &lt;Route path="/a" component={A}/&gt;
              &lt;Route path="/b" component={B}/&gt;
          &lt;/div&gt;
      &lt;/BrowserRouter&gt;,
      document.getElementById('app')
  )
  </code></pre>
  
  <p>The console prints "a" but the listen-callback never gets called when I click around and my URL changes.</p>
  
  <p>There is not much more in their documentation so does anyone know what is missing?</p>