Epix
Epics without redux-observable.
Why?
Epics are a very strong pattern to build maintainable applications with RxJS. They were pioneered by redux-observable, which forces you to use Redux. Epix is for all the cases where you manage your state without Redux.
Install
yarn add epix
or
npm install epix
API
;; const action$ = ; { return action$;} { return ;} const epics = logMessageEpic doNothingEpic; ; action$next type: 'logMessage' message: 'Hello world';
If you have no idea what's going on here, I recommend getting accustomed with redux-observable first.
startEpics(epics, action$, [options])
This is epix
's replacement of createEpicMiddleware
and combineEpics
in a single function.
Arguments
epics: Array<Epic>
: your epics. The order matters, epics higher up in the array run before otheraction$: Subject
: the action stream, that actions will go trough.[options: Object]
: pass what you want here. It will be made available to all epics as their second argument.
TypeScript
Define your epics with Epic
as a type.
;;
Define an action type.
;
Use it.
;startEpics<Actions,>epics, action$, ;