-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Description
What should redux.dispatch()
return? Currently the code is
function dispatch(action) {
return typeof action === 'function' ?
action(dispatch, state) :
dispatchSync(action);
}
but I don't remember the circumstances when the return value of the callback form can be useful.
Because the callback form may schedule additional dispatch
es, it seems that the calling code still doesn't have enough information. Can we just return whatever action
was passed?
function dispatch(action) {
if (typeof action === 'function') {
action(dispatch, state);
} else {
dispatchSync(action);
}
return action;
}
?
Metadata
Metadata
Assignees
Labels
No labels