Redux uses a special object called the store. The store acts as a container for state, it provides a way to dispatch actions, and it calls the reducer when actions are dispatched. In nearly every Redux application, there will only be one store.
We can rephrase our data flow using the new term:
- The store initializes the state with a default value.
- The view displays that state.
- When a user interacts with the view, like clicking a button, an action is dispatched to the store.
- The store determines the new state by calling the reducer with the current state and dispatched action.
- The view is updated to display the new state.
We won’t be writing any code for the store during this lesson, but it’s important that you understand this term for future Redux lessons.
Follow the diagram’s one-way data flow. Notice how the store contains the reducer and state. It receives actions and calls the reducer with the action and current state.