NgRx Reducer Design

  • Think of a reducer as a function that gets the current state, and depending on the action, returns the new state.
  • You may wonder who does the job of persisting this new state in the store and triggering all observers? The former is done by ngRx and the latter is simply RxJS behavior, ie when the observable is updated, the observers are invoked.
  • Hence, the reducer doesn’t need to worry about updating the store or notifying the observers, but instead just perform it’s logic and return the new state

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s