NgRx Store and Effects
As covered in Chapter 1, Introduction to Angular and Its Concepts, the NgRx library brings reactive state management to Angular based on RxJS. State management with NgRx allows developers to write atomic, self-contained, and composable pieces of code, creating actions, reducers, and selectors. This kind of reactive programming allows side effects in state changes to be isolated. In essence, NgRx is an abstraction layer over RxJS to fit the Flux pattern.
There are four major elements of NgRx:
- Store: The central location where state information is persisted. You implement a reducer to store a state transition in the store and a selector to read data out of the store. These are atomic and composable pieces of code.
A view (or user interface) displays data from the store by using a selector.
- Action: Unique events that happen throughout your app.
Actions are triggered from a view with the purpose of dispatching...