On workspace, my colleagues told me that i must instead of writing this
import store from './store.ts'
// Epic code
...
mergeMap(data => {
store.dispatch(someActionCreator(data))
return EMPTY
})
...
should write something like this
// Epic code
...
mergeMap(data => {
return of(someActionCreator(data))
})
...
I know that all actions which are written in of rxjs operator will be automatic wrapped in dispatch function and dispatched automatically, but why it is bad to dispatch all actions like in the first example?
Yes, we will not return any stream$, but if its a last iteration in sequence, do we really need to return this stream$ instead of manual dispatch?