5

I see a lot of articles that mention using a single app store such as Redux for Angular2. Lets say you have your todoList example component and some other state that doesn't affect the list like a display username. If you change the username value, then you will get a brand new state object, which would cause the rerendering of the entire todoList. Isn't this wasteful?

B. Kim
  • 51
  • 1
  • distinctUntilKeyChanged function does excatly what you are looking for: http://stackoverflow.com/questions/38370838/ngrx-store-subscription-to-part-of-a-store-and-avoid-detecting-changes-to-other . Information about distinctUntilKeyChange: https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/distinctuntilchanged.md – Stav Alfi Aug 03 '16 at 11:27

1 Answers1

0

In general, no. Using patterns like Redux and Ngrx for Angular 2 specifically seems to be emerging as a best practice. I'm using it myself, and I don't notice any difference in performance when using Ngrx, even when I'm pulling the state from local data storage.

Jim
  • 3,821
  • 1
  • 28
  • 60