What is NgRx?
NgRx is a framework for building reactive applications in Angular. Reactive applications use asynchronous programming with observable streams.
NgRx is used for application state management.
- Application state is the entire memory consumed by the application but here we will reference application state as the user preferences, data obtained via API calls, UI states, and so on. For example, the application state could be user-preferred themes, a list of customers, form data entered by the user, and so on.
- The idea here is to store all the application states in a central store for data communication.
- In the end, NgRx is a single state that uses actions to express state changes.
- NgRx unifies the events in an application and derives the state using RxJS.
To summarize NgRx enables us to give a representation of the state, update its value, keep track of the state when the value changes, and, finally, retrieve the state.