From the course: Build Modern Web Apps with React, Hooks, State Management, and APIs Using Vite or Next.js

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Custom middleware: Introduction

Custom middleware: Introduction

Welcome to lesson number 9. In this lesson we are going to learn about custom Redux middleware. So what is middleware? Middleware is a piece of code that can sits between dispatching an action and the reducer. As soon as you dispatch an action from the component and it goes to the reducer to actually run the business logic behind it. Between that if you would like to have some kind of information or some kind of code to get executed then that is the place called middleware. It can intercept between log, modify or delaying some action. Maybe you want to have some logging to see that how much time it takes between your action getting dispatched and the reducer completing its work or maybe you want to modify something or add some more data to your state or you want to delay an action deliberately. You can do that by middleware code. It can be useful for scenarios where you need logging or maybe you want to do analytics or an async flow of the API calls and you want to monitor the time…

Contents