-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
actions and dispatch #23
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
Comments
in #16 the binding of action creators happens during mounting only one time. If you want to pass all app actions to all subcomponents using the new api you can do so trivially by passing all of your actions into the second argument (see example below). We wouldn't want to do that for you automatically however since it would cut off other use cases and possibly pollute connected components with unnecessary or redundant actions (imagine nested connected components for a email client where you have navigational actions for what messages are being viewed but then a component for the actual message detail view, not that this would be the optimal setup) @connect(
State => State,
require('./path/to/module/that/contains/allActions')
) |
That's exactly the intention for the new API. It is |
Actions are attached to connected components as props. Passing all actions all the time would unnecessarily pollute props of all connected components and would greatly increase the likelihood of overloading a prop and hiding an intended behavior. In more complicated apps it doesn't make sense for all components to be aware of all actions and therefore this behavior you suggest would hinder the majority for the convenience of a few |
First at all, thanks for build redux.
I read all discussion on #1 but I still don't get it:
Why Provider/Connection decoration just doesn't bind all actions creator to dispatch only once (willComponentMount or something like that) and pass it (all app actions) to nested component as props?
With the new api proposal, I still have to pass to @connect that actions that I want to use, and its look like to been "re bind" all time that render() is called... I just dont get why.. what have I missed?
The text was updated successfully, but these errors were encountered: