Creating the store
The final task in Store.ts is to create a function that creates the Redux store so that it can be provided to the React components. We need to feed all the store reducers into this function as well. Let's do this by performing the following steps:
- First, let's import the
Storetype and thecreateStoreandcombineReducersfunctions from Redux:import { Store, createStore, combineReducers } from 'redux';Storeis the top-level type representing the Redux store.We will use the
createStorefunction to create the store later.combineReducersis a function we can use to put multiple reducers together into a format required by thecreateStorefunction. - Let's use the
combineReducersfunction to create what is called a root reducer:const rootReducer = combineReducers<AppState>({ Â Â questions: questionsReducer });An object literal is passed into
combineReducers, which contains the properties in our app state, along with the...