Evolving State and Data Management with @ngrx-store and @ngrx-effects

Basically NGRX Store is the Client Side DB that can be observed for changes and can be itself changed by Recucers (that contain Actions to affect individual changes on the by the USER).

This is good, but there a a use case we’ve still left to solve, which is: How would the store be kept in sync with the remote DB? Well, you could listen to the same store, and when any action updates it, then call the svc to update the DB. Now server might send new data that you’ll have to again dispatch to local ngrx store as a new action to keep the Store in sync.

NGRX Effects is the port of Redux Saga to Angular 2 and users Observables to help compose together these disparate steps. Basically it starts from the UPDATE_TODO action from the user and ends at calling the UPDATE_TODO_DB action when the service has responded with new data.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s