Flux Comparison by Example
github.com
github.com
Most implementations rely on the flux stores being singletons which can't work for multiple requests on the server.
The only one that's isomorphic is yahoo's but that one feels terribly verbose.
I've been making an app based on yahoo's dispatchr (part of fluxible) for about 4 months now, and I hardly spend time with the "verbose" part of my app. All the real work is in data fetching, view rendering, business logic, and so on.
Really, if there's X libraries out there and X-1 don't support isomorphic apps, and the only complaint you can come up with about the one that does is that the most boring, logic-free and error-free part of your app will look a little verbose, then what are you still waiting for?
I imagine you could extend this to use Flux relatively easily - most of the hard stuff is done, and the code base is quite small.
https://github.com/appsforartists/ambidex-example--bike-inde...
It instantiates a new Reflux store for each request, and uses data in the URL to figure out which stores to populate before rendering.
Shameless plug: Fynx[0] is mostly synchronous, for example.
I want to have the same routing and data fetching logic both on the client and on the server, and for that I would need to have stores that are independent for different incoming HTTP requests.
Btw. I would love to see a full example of an isomorphic Flummox application using react-router.
That, combined with the fact that all CommonJS modules are singletons, anyway.
Which part of Fluxible feels verbose?
It would be much nicer to have e.g.:
context.actions.myAction('foo', 'bar')
And onMyAction: function(foo, bar)
- dealing with asynchronous data fetches. The example shows that you should create 3 actions for every async data action: FETCH_STARTED, FETCH_COMPLETE and FETCH_ERROR.How would you deal with cases where you need to fetch multiple data sources then combine them? Seems like the number of actions would quickly explode. Also, how would you deal with dependencies and errors?
- the service api:
context.service.read('message', {}, {}, function (err, messages)
too many optional params, kinda hard to keep track what goes where.I'd prefer something with promises.
- I also miss query params support in fluxible router
It would be cool if there was a nice way that you could wrap an action with a function to generate that boilerplate for you, similar to how Bluebird's `Promise.promisify(myFunction)` generates a Promise-wrapped function for anything following the typical Node callback style.
I've been adapting a React-based app to the Flux architecture for the last week or two. I constantly find myself scratching my head, especially regarding asynchronous operations that need to be reflected in the View.
It would be nice for the mock API in these examples to "simulate" a poor network connection in order to see how asynchronous error handling is best handled in each implementation, for instance.
It's just behind Reflux on the superficial metrics (stars, contributors, npm downloads) so is likely to be on most short-lists.
I've had a good experience with Marty so far but remain curious about the others. Reflux worries me a bit because of its minor divergences from the Flux design decisions.
I tried some sample apps in the last weeks with reflux, fluxxor and now marty to see the practical differences.
Can't wait for the post with conclusion and thoughts on this.
Why don't we have a library called Melanoma or HIV yet? Actually I am sure we do have libraries with these names somewhere on github.
Drama much?