0

I start to learn about Redux and state management approach, after reading a lot of articles I was confused between the implementation and the concept.

So I understand that:

  • Redux is the implementation of flux architecture. - source

  • flux is implementation and architecture.

I want to keep search and learn my self, so my question:

1) Flux architecture vs ....? what the other solutions/architecture.

2) "State management" concept is part of Flux architecture or this concept is can implement by other architecture?

3) "State management"? what the other solutions/concepts.

thanks all!

sForSujit
  • 987
  • 1
  • 10
  • 24
Liam
  • 957
  • 1
  • 9
  • 25

2 Answers2

1

I think you have to think more in terms of MVC vs CBA(component based architecture) rather than Redux vs MVC.

Redux helps you synchronize state between your components and really shines when you got complex component trees that share state.

I would like to point you to this excellent presentation that may help you understand the benefits of using Redux in a component based architecture.

Managing State in Angular 2 - St Louis Angular Lunch - Kyle Cordes https://youtu.be/eBLTz8QRg4Q

Lidor Avitan
  • 1,374
  • 10
  • 22
0

Ngrx is nothing but flux architecture that was first originated and created by facebook dev's which was later trimmed and changed to Redux .

It's sole use is state management.

A small scenario will make its use quite clear

I am you might have used facebook right :P so if you look @ facebook's website you will see multiple components like navbar, left panel, chatbox etc. Ever wondered when a new message is delivered to you all these are updated simultaneously how ? If they went for Observables or Event Emitters they would be engulfed in a sea of spaghetti code. Which even if implemented will be very hard to debug or make changes .

Here comes the use of ngrx state management all the information is stored @ a single place and all the components are identified when the state of the data is changed . A Look this answer from stack overflow will clear the concepts even more Image clear.

Ngrx v4 for Angular . The latest version brings some breaking changes but changes for good like featured module support in ngrx and also better payload management.

More on the same on this page.

  • For Javascript Flux or Redux is one of the most prominent use case for state management, they may be others but this is the one supported by the community largely.
  • You can implement state management in Angular using Shared services
    and Observables . and in Javascript using Observables.
Rahul Singh
  • 19,030
  • 11
  • 64
  • 86
  • thank you for answer!, i understand the facebook problem, but i do not found problem with mvc they just use single model(store) with all data and all component subscribe for the single model(store). where the problem with two way data binding or with mvc? over the web all say's in mvc if your app growth is start to be infinite loop, i cant find example for this scenario. – Liam Aug 19 '17 at 11:41
  • @AlinBenHemo i am not quite sure what you mean by mvc in front end its more like MVVC . but genreally where you have lots of parent child relation ships and you want data to be sinked scross them without loosing track of data you use ngrx , just depends upon the complexity of the application – Rahul Singh Aug 19 '17 at 12:14
  • facebook say's the mvc problem, look here https://www.youtube.com/watch?list=PLb0IAmt7-GS188xDYE-u1ShQmFFGbrk0v&time_continue=621&v=nYkdrAPrdcw – Liam Aug 19 '17 at 12:17
  • @AlinBenHemo it what you perceive as mvc . Some say it as mvvc in angular. What they mean is that your controller now had to update code in different places having multiple copies of states for each. With redux you have a single copy more like a small in memory firebase db for the application for it to refer states. So any change in data ia reflected across components. Hope you get it now – Rahul Singh Aug 19 '17 at 12:20