-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do Action objects serve any real purpose ? #11
Comments
Hey, @lorefnon, Thanks for the issue—this has come up a couple times, and I should probably include it in the docs. I actually had the same thought when I first started experimenting with flux; they definitely are another layer of indirection, though I'm now not so sure they're superfluous. You actually can dispatch actions directly if you want via
In a larger application, the extra indirection will make changes to the action/data layer easier without having to change your application's components. It also allows changes to the Fluxxor dispatcher without needing to change either (1) your components (because they don't know about the dispatcher at all) or (2) your action methods (because Related to the first point above, the actions also give you semantically meaningful method names: See also Creating Semantic Actions on the React site:
Hope that helps; this is a really interesting topic to me, so feel free to keep thinking about/discussing it! |
Thanks for the reply, @BinaryMuse . I see where you are coming from, thank you for taking the time to elaborate. |
Action objects like the following:
seem like a superfluous layer of indirection that provides no real advantage.
Is there any advantage to having the action objects at all rather than just making a singleton dispatcher available to the views. After all, all that the actions seem to do is translate method calls to dispatch calls, passing on their payload. Why couldn't the views make dispatch calls directly ?
The text was updated successfully, but these errors were encountered: