Isolating Side Effects from Components
Explore how to isolate side effects from Angular components by using NgRx Effects. This lesson guides you through removing service calls from components, dispatching actions to trigger effects, and updating the store for better maintainability and testability of your application.
We'll cover the following...
We'll cover the following...
Introduction
The purpose of using NgRx Effects is to remove side effects from the Angular components. In our src/app/products/products.component.ts file, we’re using the ProductsService class to fetch product data from the server. In this lesson, we’ll refactor the ProductsComponent to remove the side effects.
Retrieving the products data from the server
Removing side effects
Let’s remove the ProductsService-related code from the ...