Installing Redux and Redux Thunk

Before we can use Redux, we need to install it, along with the TypeScript types. We will also install an additional library called Redux Thunk, which we need in order to implement asynchronous actions. Let's look at the steps to install Redux:

  1. If we haven't already, let's open our project in Visual Studio Code from where we left off in the previous chapter. We can install the core Redux library via the Terminal with the following command:
> npm install redux

Note that the core Redux library contains TypeScript types within it, so there is no need for an additional install for these.

  1. Now, let's install the React-specific bits for Redux in the Terminal with the following command:
> npm install react-redux

These bits allow us to connect our React components to the Redux store. 

  1. Let's also install the TypeScript types for React Redux:
> npm install @types/react-redux --save-dev
  1. Let's install Redux Thunk as well:
> npm install redux-thunk

Redux Thunk contains its own TypeScript types, so there is no need for an additional install for these.

With all the Redux bits now installed, we can start to build our Redux store.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.123.183