-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Proposal: change custom dispatcher signature #68
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
We also need to rethink where the state "lives." In the current version, there's no way for the Redux instance to push a new state atom to the dispatcher — for instance, a call to |
The thing is, I'm not sure we want to expose I want the state flow from dispatcher to Redux and never the other way around. This makes it much easier to create custom dispatchers IMO. |
I thought about it a bit more, and the only change I'll probably do here is make |
So the signature stays the same (with |
Yep. |
👍 |
As rightly noted by @vslinko, it's better to provide
getState
instead ofinitialState
.I think I was wrong now when I said this. In fact, I find it now easier to implement composable dispatchers only if each “parent” has the ability to “intercept” both
getState
andsetState
, and if the child can “query” the latest state.I'm going to keep this open for a while, as I'm still not 100% sure which approach is more correct, but I'm leaning towards
(getState, setState) => action => ()
now as the signature for the dispatcher.The text was updated successfully, but these errors were encountered: