Angad
Angad

Reputation: 1174

Angular 2/4 redux framework

Can you tell me what is the difference between ng-redux vs ngrx-store library in angular? I want to implement redux in my application but not sure which library to use and what are the benefits?

Upvotes: 1

Views: 234

Answers (1)

uroot
uroot

Reputation: 36

They both implement centralized state for your front-end, but I'd use ngrx/store for an Angular 2 app, because:

  • ngrx is built on RxJS, which is also the basis for Angular 2's http module; This allows for various possibilities for interacting with your components like store && dispatcher through RxJS methods like filter, transform data... I also thought it was nice having the Observable pattern implemented uniformly for all my data logic. RxJS observables provide a more robust manner to interact with data related actions
  • One method I thought was particularly cool was select(key) on the store module, which selects the specified state key and returns an observable that can be shared from a centralized service to multiple components; This minimized store subscription from components themselves and allowed for easy state updates from container(stateful) to component(stateless) leveraging Angular 2's change detection and async pipe.

Upvotes: 2

Related Questions