I am building an application with react-native using redux-observable. Right now I am struggling to do a simple decoration over two actions in redux-observable by using an epic. What I am trying to achieve is simply to map two actions to one.
The error I am getting is:
You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
Here is the code I am using:
import { Observable } from 'rx';
export const startApplicationEpic = (action$: Observable) =>
action$
.ofType('START_APPLICATION')
.flatMap(() =>
Observable.of(
{ type: 'REGISTER_PUSH_NOTIFICATIONS'},
{ type: 'AUTHENTICATION_REQUEST' }
)
);
// index.js
store.dispatch({ type: 'START_APPLICATION' })
To me the RxJS code I am using is valid, and if epics are a stream than this should work, or is it only possible to dispatch a single action from an epic?
rxjs
and notrx
. – martinrxjs
notrx
– jayphelps