DEV Community

loading...

Angular 6 NgRx Store example – Angular State Management

javasampleapproach profile image JavaSampleApproach ・1 min read

https://grokonez.com/reactive-programming/angular-6-ngrx-store-example-angular-state-management

NgRx Store is a state management solution for Angular apps that helps us build applications by working around our app’s data (state). In this tutorial, we’re gonna look at how to work with NgRx Store, custom Actions, Reducers. Then we will practice to understand all of them in a simple practical Angular 6 example.

Why we need a State container
State container helps JavaScript applications to manage state.
=> Whenever we wanna read the state, look into only one single place – NgRx Store.
=> Managing the state could be simplified by dealing with simple objects and pure functions.

NgRx Store
Store holds the current state so that we can see it as a single source of truth for our data.
– access state using store.select(property) (property is defined at app.module.ts in StoreModule.forRoot()).
– update state via store.dispatch(action).

All tutorial at: https://grokonez.com/reactive-programming/angular-6-ngrx-store-example-angular-state-management

Related posts:

Discussion (0)

pic
Editor guide