As mentioned previously, the entire state of the application is stored as a single object inside a construct called the store. The store is central to a Redux application, so let’s create it. Inside src/index.jsx, add the following lines:
import { createStore } from 'redux';
const initialState = {};
const reducer = function (state = initialState, action) {
return state;
}
const store = createStore(reducer, initialState);
The createStore method accepts three parameters:
- reducer function: A function that takes in the current state and an action, and uses them to generate a new state.
- initialState any: The initial state. The initialState can be of any data type, but we will use an object literal here.
- enhancer function: A function that takes in the current store, and modifies it to create a new, "enhanced" store. You may wish to use enhancers to implement middleware:

At the moment, we’ll just focus on creating a store with a state, so we’re using a dummy reducer, which simply returns the state.
The store object has many methods, the most important of which are:
- getState: Gets the current state of the store
- dispatch: Dispatches an action to the store
- subscribe: Subscribe functions to run whenever the store’s state changes
We will be using these three methods to implement our Redux integration.