-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Description
Original redux dispatch
allow to pass more than one argument thats in result will be received in the middleware and all passed arguments will be logged. It's very useful and flexible. But dispatch
function that passed to mapDispatchToProps
handle only first argument and middleware always log array with that first argument.
// Redux 3.6.0
const middlewares = [
function logArguments (store) {
return next => (...args) => {
console.log(args);
next(...args);
}
}
];
const store = createStore(() => {}, applyMiddleware(...middlewares));
store.dispatch({ type: 'NOOP' }, { arg: 'second' }, { arg: 'third' });
// [ { type: 'NOOP' }, { arg: 'second' }, { arg: 'third' } ]
Actually i didn't find any documentation about this way to use dispatch
so it'll be nice to also clarify that moment.
Metadata
Metadata
Assignees
Labels
No labels