A Redux Store consists of a few different parts. You always have a single store, that uses either a single Reducer or Multiple Reducers (through Redux’s CombineReducers method). And you dispatch actions to your reducers. (You also have the initial state for each reducer, that is the default values)
Store = is like an instance of a class. It contains the actual data.
A reducer takes the current state + an action, applies it to the state and returns the new state.
If you look in the gist above you see everything you need to set up a basic redux setup. You can make it how simple or complex you want to. I personally just make multiple reducers, and action-creator methods that update them.
The awesome thing about redux is that it isn’t a “react thing”. This means that you could use the same state layer with any front end library or framework.
If you want to use it with react then you need two things from the the react-redux package: Provider and Connect.
You place the around the JSX code in your ReactDOM render() method in your entry point. And then you use the connect() method to map functions and state elements to your components.
You map state elements to your components so that what is in redux are passed as props to your components, and you map your action creators to your component through connect so that the action creators have access to your store’s dispatch method.
Something like this:
As usual, the code above is working, but you need to add some imports etc to have a working example.