I see the following two styles of action in Redux:
From the documentation:
export function createFoo(foo) {
return {
type: ActionTypes.CREATE_AUTHOR,,
foo
}
}
...and from another tutorial (PluralSight):
export function createFoo(foo) {
var newFoo = FooApi.saveFoo(foo);
Dispatcher.dispatch({
actionType: ActionTypes.CREATE_FOO,
foo: newFoo
});
}
The latter appears to have more responsibility, creating an author instance and dispatching an event.
Why is there a difference in approach? Are these two separate idioms (possibly one expects middleware to perform dispatching?).