Analysis of Flux implementations
Asked Answered
A

3

6

I'm studying the react ecosystem, I came from the AngularJS world and I have no idea which flux implementation should I use...

Can anyone explain what's the best, considering that I love the MV* structure of angularjs (1x)?

I'll appreciate focus on:

  1. Differences between them
  2. Goals
  3. Learning Curve
  4. Usage Sharing
  5. Testability
  6. Scalability
  7. adherence to new standards (both in terms of ES6 and WebDevelopment Trends)

I found many resources but I still have many doubts!

Thanks in advance

Angulate answered 15/12, 2015 at 15:42 Comment(0)
P
2

I've been using for new project AltJS and to be honest, I love it.

2, 4 - It is pretty fancy due to the "usage sharing" (if I understand what you meant by that correctly). You create "logic" and "pure (dumb)" components which later on can be used plenty of times (there is no point to create identical view but with a different logic, so you simply "pick other store" for the same "pure" component"). Also it can easly track other Stores states, use many Stores at once in one component thanks to AltContainer (you definetly should try AltJS with AltContainer) and use actions from one store, while the other store gets updated (bindListeners).

3 - About learning curve, well I would say it is pretty easy to understand whole concept. It would literally take you at most one day to understand whole idea. Ofcourse there are more complex stuff involved there as well, but there always are some more complex stuff in other libraries as well.

5 - You can easily test actions and stores (there is even an example of that on their page) using "AltTestingUtils". You can also mix with with Chai or any other assertion library you are using. So that's pretty good I would say

6 - well wasn't whole idea of Flux about "scalability" as well? If we consider that AltJS is probably one of "purest" implementation of that, then I would say it should be pretty well in that. So far I can say that it is working for me well (though it is hard to see the future, cause right now it ain't that big). Though there are some tools to improve performance if problems with scalability would appear (for example, AltContainer does have shouldComponentUpdate).

7 - Whole AltJS was done to work in ES6, at least they say so (and I use it like that as well)

While alt examples encourage ES6 and alt was built with ES6 in mind it is perfectly valid to use plain old JavaScript instead.

I made a post about AltJS some time ago in other topic, you might find it helpful

https://mcmap.net/q/87092/-how-can-i-communicate-between-related-react-components

Prescribe answered 19/12, 2015 at 16:31 Comment(3)
for usage sharing i mean: it is preferred by the community? Because in my opinion is a useful indicator. Sorry for the misunderstand. your answer is helpful!Angulate
Ah then I misunderstood you. Well altjs Has planty of user, but is it used as often redux od reflux - this one i do not knowPrescribe
Your answer was the only which centered my question, so, the bounty is your... Thanks!Angulate
S
3

A preexisting reference is here - https://medium.com/social-tables-tech/we-compared-13-top-flux-implementations-you-won-t-believe-who-came-out-on-top-1063db32fe73#.l0ui3uq2z.

However, when I started delving into Flux, I went with community ratings on Github and number of downloads in npm. Reflux was on top on both accounts. My rationale was that if a framework is popular and a lot of folks understand and use it, it should be simple. Being new to React and Flux I already had a lot to absorb and I found Reflux to be easier to understand because it took care of a lot of setup needs Flux has. However this may or may not be a desirable thing for the next person if you take the purist stance and want to stick to the core Flux paradigm as proposed by FB. I have read that Alt and Redux are more closer to it and they are also very popular at the moment.

tl;dr; Read Flux, then read at least three to four different frameworks and then take your pick.

Stites answered 18/12, 2015 at 4:18 Comment(3)
Your link is outdated as it is ignorant of Redux. In my opinion : Reflux is simple - but become super simple (and pure) with this architectureCasting
That's the whole point of my comment. I think it's more important to understand flux first and then read popular implementations before deciding.Stites
Reflux for me is also by far the easiest way to approach flux concept. It has no dispatcher part that brings more complex to the concept (although very important to understand). you can follow the Reflux Sweeper game example over here: dimagimburg.com/…Cub
E
2

I suggest you to start with Flux and thats the Facebook's original implementation of Flux architecture, the examples can help you understand it.

https://facebook.github.io/flux/

Once you understand how Flux works then you will know and decide which other implementations you want to use such as Redux, Flummox, Alt, etc...

Elflock answered 15/12, 2015 at 17:26 Comment(1)
Hi, of course this is basilar and I'll do that, but, what I want is a presentation of that implementations, their differences, their focus and something else that helps to undestand why there are many implementations.Angulate
P
2

I've been using for new project AltJS and to be honest, I love it.

2, 4 - It is pretty fancy due to the "usage sharing" (if I understand what you meant by that correctly). You create "logic" and "pure (dumb)" components which later on can be used plenty of times (there is no point to create identical view but with a different logic, so you simply "pick other store" for the same "pure" component"). Also it can easly track other Stores states, use many Stores at once in one component thanks to AltContainer (you definetly should try AltJS with AltContainer) and use actions from one store, while the other store gets updated (bindListeners).

3 - About learning curve, well I would say it is pretty easy to understand whole concept. It would literally take you at most one day to understand whole idea. Ofcourse there are more complex stuff involved there as well, but there always are some more complex stuff in other libraries as well.

5 - You can easily test actions and stores (there is even an example of that on their page) using "AltTestingUtils". You can also mix with with Chai or any other assertion library you are using. So that's pretty good I would say

6 - well wasn't whole idea of Flux about "scalability" as well? If we consider that AltJS is probably one of "purest" implementation of that, then I would say it should be pretty well in that. So far I can say that it is working for me well (though it is hard to see the future, cause right now it ain't that big). Though there are some tools to improve performance if problems with scalability would appear (for example, AltContainer does have shouldComponentUpdate).

7 - Whole AltJS was done to work in ES6, at least they say so (and I use it like that as well)

While alt examples encourage ES6 and alt was built with ES6 in mind it is perfectly valid to use plain old JavaScript instead.

I made a post about AltJS some time ago in other topic, you might find it helpful

https://mcmap.net/q/87092/-how-can-i-communicate-between-related-react-components

Prescribe answered 19/12, 2015 at 16:31 Comment(3)
for usage sharing i mean: it is preferred by the community? Because in my opinion is a useful indicator. Sorry for the misunderstand. your answer is helpful!Angulate
Ah then I misunderstood you. Well altjs Has planty of user, but is it used as often redux od reflux - this one i do not knowPrescribe
Your answer was the only which centered my question, so, the bounty is your... Thanks!Angulate

© 2022 - 2024 — McMap. All rights reserved.