News for hackers. Stuff that matters.
Re:What the Flux? by highpixels on Tuesday January 27, 2015 @03:15PM (#8955481)
I've never quite understood Flux, partly due to all the cruft & boilerplate involved around Actions & Action Creators.

I've found a Command Bus pattern (a la CQRS) works much nicer, and cleaner.

1. Something happens in View (e.g. todo item is checked) 2. View passes a "CompleteTodoItemCommand" object to the Command Bus 3. Command Bus dispatches the Command to a registered Handler 4. Handler communicates with server, store etc. to handle the command; handing TodoItem to the store 5. Store triggers change event 6. View hears change event, renders self

That said, I've only built a few smaller projects in React, so perhaps I'm missing something important which Flux solves and I'm missing?

Re:What the Flux? by lobster_johnson on Wednesday January 28, 2015 @02:08AM (#8958519)
That's exactly how we build our Flux apps. We follow, roughly, the Flux naming patterns -- your "bus" is the dispatcher, "handler" is the store's dispatch handler, everything else is the same -- but we left out the action creator thingies and instead direct actions directly to stores and let them do the data state management.