Effects are mainly used for isolating side effects from the component and so your component can be purer.
In a service-based Angular application, components are responsible for interacting with external resources directly through services. Instead, effects provide a way to interact with those services and isolate them from the components. Effects are where you handle tasks such as fetching data, long-running tasks that produce multiple events, and other external interactions where your components don’t need explicit knowledge of these interactions.

We can use different Rxjs operator for different scenarios like:

  • MergeMap - can be used for Deleting items
  • concatMap - can be used for Updating or creating items
  • exhaustMap - can be used for getting some data from the server.
  • switchMap - can be used for search functions.

GitHub: https://github.com/funOfheuristic/ngrx-tutorial/tree/ngrx-effects

#angular #ngrx

Effects in NgRx | Use of NgRx Effects with Angular
5.15 GEEK