title: Is triggering an action in the store bad practice?
body: <p>Stores are supposed to handle the events triggered by actions and emit the change to the listening view controllers.</p>
  
  <p>Is it ok for them to trigger actions as well, for example in the callback of a request or directly in the store's registered callback.</p>
  
  <p>For example:</p>
  
  <pre><code>AppDispatcher.register(function(payload) {
  
    switch(payload.action.actionType) {
  
      case Constants.PAGE_CHANGED:
        ActionCreator.fetchNewData();
        break;
  
      case Constants.FETCH_DATA:
        // save data
        Store.emitChange();
        break;
    }    
  });
  </code></pre>
  
  <p>Is code like this "correct" in the Flux architecture ?</p>
  
  <p>Thank you !</p>
  
  <p>====== UPDATE BASED ON COMMENTS:</p>
  
  <p>This is not a question of "I need to do this. How do I do it ?", but "Should this be a way of doing things". And I guess the answer is ... its your choice.</p>
  
  <p>Some useful links were added in the comments, thanks for that.</p>
  
  <p>My understanding of things is as follows:</p>
  
  <p>In Flux architecture, the views should be the only ones triggering actions. Put the asynchronous requests in your action creator and the callback should launch a new action.</p>
  
  <p>When not following the Flux steps, the store can also handle the asynchronous requests but make sure that the callback does not handle the data directly, but triggers another action instead. See Bill Fisher's answer regarding this.</p>
  
  <p>In any case, as Ben Alpert's answer said, you can create multiple actions for a user action (eg: REQUEST_START, REQUEST_SUCCESS, REQUEST_ERROR), which allows you to hook into the different stages of your request.</p>
  
  <p>Any updates on this are welcomed.</p>