Installing Redux

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:

  1. If we haven't already, let's open our React shop project in Visual Studio Code from where we left off in the last chapter. So, let's install the core Redux library via npm in the terminal:
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. Let's now install the React-specific bits for Redux. These bits allow us to connect our React components to the Redux store. Let's install these via npm:
npm install react-redux
  1. Let's also install the TypeScript types for react-redux:
npm install --save-dev @types/react-redux
  1. Let's install redux-thunk as well:
npm install redux-thunk
  1. Lastly, we can install the TypeScript types for redux-thunk:
npm install --save-dev @types/redux-thunk

With all the Redux bits now installed, we can add Redux to the React shop we have been working on in the next section.

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

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