Closed zimt28 closed 9 years ago
Hi ho!
Yeah I already thought about reflux, the only thing that concerns me (a bit) is that Facebook mainly created the Dispatcher
to limit the dispatching of actions to only one per cycle. However I don't know how important this really is, because I never had problems with cascading UI updates like they mention. It might be that they just had a really messy architecture before using react + flux and thought that it's important enforce this restriction.
The biggest advantage of Reflux is that it favors composition over inheritance, so I can imagine that it would make the code even more concise. The only "problem" I see, is that it creates much more runtime objects, since each action basically becomes its own dispatcher (with the full capabilities / and code) behind it.
I will think about it, but maybe it would make it better :-)
That would be great :) Please let me know when you come up with something new!
Hey @zimt28! Please have a look at the latest 3.2.0 release (TodoMVC example) - I found a way to keep the current architecture using a single dispatcher but simplify the actions api so that you can dispatch them like normal functions (similar to reflux). However this is much, much simpler than reflux does it. It actually just syntactic sugar on top of the previous solution ;-)
So actions don't have methods like listenTo
nor do they manage the subscriptions themselves. However, the biggest advantage of reflux seemed to be the simplification introduced by making them callable like functions, so now its possible to dispatch an action like this @actions.toggleTodo(todo)
instead of @dispatch @actions.TOGGLE_TODO, todo
closing this now, as the API has improved to be simple like reflux :-)
Hey! That looks great, thank you :) Looks like it's time now to start switching to this solution, just have to figure out the best approach :D But I think I will just convert simple pages first and then go on to the more complex ones.
Glad you like it, you were right – it's much nicer that way! I already refactored my code in my Prisma app too :-)
Sorry for creating all the issues but I'd love to learn this as your code just looks too nice and clean :) Have you seen Reflux? It's based on facebook's flux but gets rid of the dispatcher and seems to be easier to understand.
See
By the way: will you maintain this package or is it going to stay as-is and die slowly? Just asking because this happens to quite some packages ..