Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Analysis of Flux implementations

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

like image 787
Hitmands Avatar asked Dec 15 '15 15:12

Hitmands


2 Answers

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.

like image 69
hazardous Avatar answered Sep 18 '22 15:09

hazardous


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://stackoverflow.com/a/34256824/5538090

like image 23
Shiroo Avatar answered Sep 20 '22 15:09

Shiroo