Redux is an open-source js library for handling web application state. This library can be used in different web app frameworks such as React and Angular. The following outlines how to use redux in react web applications.
There are two ways for adding redux to your project in case you want to initialize a new react app, or add redux to your current react app.
In case you want to create a react app using redux, easily write the following command:
npx create-react-app my-app --template redux
Otherwise, if you prefer to code by TypeScript you can run the below command:
Redux-Saga is a middleware library which is handling async tasks with side effects, such as API. Also, we are able to read the state and call actions on Saga. It uses generator functions in order to do async tasks.
The following outlines why we use Saga and how to install it. Then, it is discussed useful Saga methods for handling API.
The main duty of the Saga is to handle the API calls and update the state based on the response of endpoints! One of the main advantages of redux-saga is being test-friendly.
Before working with Redux-Saga, you should be…