Store

    The Store is the object that brings them together. The store has the following responsibilities:

    • Holds application state;
    • Allows state to be updated via ;
    • Registers listeners via ;

    It's easy to create a store if you have a reducer. In the , we used to combine several reducers into one. We will now import it, and pass it to .

    Now that we have created a store, let's verify our program works! Even without any UI, we can already test the update logic.

    You can see how this causes the state held by the store to change:

    We specified the behavior of our app before we even started writing the UI. We won't do this in this tutorial, but at this point you can write tests for your reducers and action creators. You won't need to mock anything because they are just pure functions. Call them, and make assertions on what they return.

    index.js

    Before creating a UI for our todo app, we will take a detour to see how the data flows in a Redux application.