redux-observable-adapter-rxjs-v4
v0.0.3
Published
Use RxJS v4 with redux-observable
Downloads
5
Maintainers
Readme
redux-observable-adapter-rxjs-v4
Use RxJS v4 with redux-observable
Please upgrade to 100% RxJS v5 ASAP
This library is meant as a stop gap to help ease migration progressively, not as a band-aid for indefinite interop.
Install
This has a peer dependency of rx@4.*.*
, which will have to be installed as well.
npm install --save redux-observable-adapter-rxjs-v4
Usage
This library basically will convert the v5 ActionsObservable
provided to your Epics into a v4 version. Then the v4 Observable you return will be converted back to v5 inside the middleware.
import v4Adapter from 'redux-observable-adapter-rxjs-v4';
const epicMiddleware = createEpicMiddleware(rootEpic, { adapter: v4Adapter });
// your Epics are now v4 streams
const fetchUserEpic = action$ =>
action$.ofType(FETCH_USER)
.select(fetchUserFulfilled); // .select() is a v4-only operator for .map()
Upgrading to RxJS v5
We suggest you upgrade your app to use RxJS v5 as soon as possible. To ease that migration, you can also include the rxjs-compatibility library to start using RxJS v5 in your Epics while you transition the rest of your app away from v4.
After you've run patchObservables()
, you can opt Epics into v5 (or v4) version with the new operators:
const exampleEpic = action$ =>
action$.v4().anyV4Operators().v5();