title: How do I wait for 2 actions to dispatch another action
body: <p>I'm looking for a way to dispatch an action once I know multiple actions have been dispatched. I know that I can do this now by storing some variables in store. But is there a better way of doing it (Saga, Discoverables) etc. I tried to go through their documentation, but couldn't understand if it can be used for this purpose.</p>
  
  <p>E.g in the below code, I want to dispatch some action in middleware when I know that 2 required actions have dispatched</p>
  
  <pre><code>import React, { Component } from 'react';
  import ReactDOM from 'react-dom'
  import {createStore, applyMiddleware} from 'redux'
  import {Provider} from 'react-redux'
  
  const dummyReducer = (state=null,action) =&gt; {
      return state
  }
  
  const defaultAction1 = { type: 'DEFAULT_ACTION1'}
  const requiredAction1 = { type: 'REQUIRED_ACTION1'}
  const requiredAction2 = { type: 'REQUIRED_ACTION2'}
  
  const middle = (store) =&gt; (next) =&gt; (action) =&gt; {
      if(action.type === 'REQUIRED_ACTION1')
          console.log('Required actions satisfied')
      next(action)
  }
  
  const store = createStore(dummyReducer, applyMiddleware(middle))
  
  store.dispatch(defaultAction1)
  
  //Dispatch an action after 2 secs
  setTimeout(store.dispatch.bind(null,requiredAction1),2000)
  setTimeout(store.dispatch.bind(null,requiredAction2),4000)
  
  class DummyComponent extends Component{
      render(){
          return(&lt;h1&gt; nothing to see here &lt;/h1&gt;)
      }
  }
  
  ReactDOM.render(&lt;Provider store={store}&gt; 
                      &lt;DummyComponent /&gt;
                  &lt;/Provider&gt;, 
                  document.getElementById('root')
  );
  </code></pre>