In this section, we'll create a store that is going to hold our state and manage the actions and reducer:
- Let's start off by creating a new file called Store.tsx with the following import statement to get the bits and pieces we need from Redux:
import { applyMiddleware, combineReducers, createStore, Store } from "redux";
- createStore is a function we'll eventually use to create our store
- We need the applyMiddleware function because we need to use the Redux Thunk middleware to manage our asynchronous actions
- The combineReducers function is a function we can use to merge our reducers together
- Store is a TypeScript type we can use for the store
- Let's import redux-thunk:
import thunk from "redux-thunk";
- Finally, let's import our reducer and state type:
import { productsReducer } from "./ProductsReducer"...