title: React Router where to use AJAX
body: <p>I am working on a project using <a href="https://github.com/rackt/react-router">React Router</a>, and I'm having some problems with the data flow.</p>
  
  <p>On every page there is an AJAX call that gets the data for the component. I have been putting them in <code>componentDidMount</code>:</p>
  
  <pre><code>// Below code is written in ES6
  componentDidMount(){
    $.get(someURL, (data)=&gt;{
      this.setState({data:data})
    })
  }
  </code></pre>
  
  <p>Although this works on initial load, it does not get called again when the url changes (a manual refresh is needed). I cannot seem to find a proper <a href="https://facebook.github.io/react/docs/component-specs.html">life cycle</a> to place the AJAX calls.</p>
  
  <p>Someone please enlighten me with the proper approach to getting data in React Router.</p>