title: How to get last action-type dispatched on the store from the store itself?
body: <p>I'm creating a component that handles the state with <strong>Redux</strong> architecture (yes, this is probably bad by definition because a component should delegate the state to the app but anyway).</p>
  
  <p>This component accepts different <strong>props</strong>. My problem comes when I have to handle a callback. Let's put a practical example to picture this better.</p>
  
  <p>Let's say we need a component like <code>&lt;App onSubmit={() =&gt; {}} /&gt;</code>.</p>
  
  <p>We could <strong>create a store</strong> when the component gets <strong>mount</strong>, so then all inner components can dispatch actions/subscribe changes/etc.</p>
  
  <p>The attempt could be to have an <strong>action</strong> called <code>submit()</code>. This way the <strong>store</strong> will know there's a change to apply so <strong>any subscriber</strong> will know and somebody will call this <strong>onSubmit</strong> callback.</p>
  
  <p>So the code would look like:</p>
  
  <pre><code>class App extends Component {
    constructor (props) {
       super(props)
       this.subscriber = this.subscriber.bind(this)
    }
    componentWillMount() {
      this.store = createStore()
      this.store.subscribe(this.subscriber)
    }
    subscriber (action) {
      if (action.type === 'submit')
        this.props.onSubmit()
    }
    render () {
      return (
        &lt;Provider store={this.store}&gt;
           &lt;FooComponent /&gt;
        &lt;/Provider&gt;
      )
    }
  }
  </code></pre>
  
  <p>The problem is that, although <code>subscriber</code> is called on every action dispatched, <strong>subscriber can't know what was the last action dispatched</strong>. So there's no way to know when to call <code>onSubmit</code>.</p>
  
  <ul>
  <li>How can we use <code>subscriber</code> to know changes on the store?</li>
  <li>Should I stop trying a redux arquitecture in here?</li>
  </ul>