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.

Benefits and summary

Benefits and summary

Welcome back, let's discuss the benefits of using custom middleware. The first benefit is we get a centralized place for cross-cutting concerns, like during the transitions of requests going through actions till the reducers, if we need to have any kind of logic being placed or any monitoring to happen, then custom middlewares provides us this space. It keeps the reducers pure because we don't have to write logs inside the reducers. We get a segregated middleware pipelines and we can write our custom code in a separate files rather than using the reducers to write the log statements. middleware helps us with derived states such as if we want to do sorting, filtering and aggregations we can counter that how much time we are taking between these and based on the data we are dealing with what is the actual performance of our code. So middlewares can help us test our code as well and derive the performance statements And with that, we have successfully completed the lesson number 9. Thank…

Contents