Methods for Implementing State Management
Learn what state management is and how we can implement state management in our Angular applications.
Approaches to state management
There are a few ways we can tackle the issue of how to implement state management within our Angular applications. Some examples of how we could handle state management within an Angular application are given below:
- Manage the passing of state information through
@Input
and@Output
decorators in our Components, along with Events to send state information between components in the application. - Make use of Services and Dependency Injection to pass state information between Components and other Services.
- We could pass state information through URLs via Route Parameters.
- We can pass data around by storing data in the browser’s local storage.
- Use an Observable-based approach. For example, create Services where the state is stored and accessed through Observables that react to changes in the application.
- Using an RxJs approach based on the Redux pattern (which we will look at soon).
- Use a third-party library like NgRx, which has been designed to solve this problem.
Get hands-on with 1400+ tech skills courses.