title: Handling AJAX errors in React.componentDidMount
body: <p>According to Facebook, the best way to load initial data for a React component is to make an AJAX request in the componentDidMount function:</p>
  
  <p><a href="https://facebook.github.io/react/tips/initial-ajax.html" rel="nofollow">https://facebook.github.io/react/tips/initial-ajax.html</a></p>
  
  <p>something like so:</p>
  
  <pre><code>           componentDidMount: function () {
                  var self = this;
                  Store.fetch()
                      .done(function () {
                          if (self.isMounted()) {
                              self.setState(getLatestState());
                          }
                      })
                      .fail(function (err) {
                          throw err;
                      }).always(function(){
                          Store.addChangeListener('rc-listen',self._onChange);
                      });
                  },
  </code></pre>
  
  <p>what is the best way to handle errors in this case? Since AJAX is async, shouldn't componentDidMount take a callback as an argument?</p>