title: React+Flux: Notify View/Component that action has failed?
body: <p>I'm writing a Registration Form Component. When form submits it triggers a create user action. createUser actions creates a new user via an ajax api call. If a user already exist, triggered user action fails. We know we cannot return a response from an ajax call, we need a callback for that. How do i tell me component that a user already exists?</p>
  
  <pre><code>// Register From Component
  var Register    =   React.createClass({
      saveUser : function(event){
          event.preventDefault();
          userActions.createUser(this.state.user);
      },
  
      render : function(){
          return (
              &lt;div className="register-form"&gt;
                  {message}
                  &lt;RegisterForm
                      user={this.state.user}
                      onChange={this.saveUserState}
                      onSave={this.saveUser}
                      errors={this.state.errors} /&gt;
              &lt;/div&gt;
          );
      }
  });
  
  // Api Ajax call
  module.exports = {
      saveUser : function(user) {
          $.ajax({
              type : 'POST',
              data : {
                  email : user.email,
                  password : user.password
              },
              success: function(res){
  
              }
          });
      },
  };
  
  // Actions
  var UserActions = {
      createUser : function(user){
          var newUser = UserApi.saveUser(user);
  
          Dispatcher.dispatch({
              actionType : ActionTypes.CREATE_USER,
              user : newUser
          });
      }
  };
  </code></pre>
  
  <p>I was thinking of returning a boolean value from createUser method.</p>
  
  <pre><code>...
  onSave : function(event){
  
      if(userActions.createUser(this.state.user)){
           // 
      }
  }
  ...
  </code></pre>
  
  <p>But we cannot return a value from ajax request, how can i notify my component that api has failed to create a new user, so that it can render a error message to user.</p>