O'Reilly logo

React Native By Example by Richard Kho

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Stores

A store is an object that brings actions and reducers together. It does the following things for us:

  • Contains the application state
  • Gives access to that state, via a method called getState
  • Dispatches actions, which reducers then use to modify that state

One thing to be aware of with Redux is that, in a given application, you will only ever have one store. In the event that we want to split our logic into multiple handlers, we'll actually split the reducers instead, through a method called reducer composition this is something we'll take a look at once we need it.

Here's how a sample store in Redux looks. Let's assume we have the task reducer from before, and another one as follows:

 import { combineReducers, createStore, compose ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required