redux-observable

redux-observable - dispatch multiple redux actions in a single epic

﹥>﹥吖頭↗ 提交于 2019-11-28 23:41:43
问题 I'm looking for way of dispatching multiple redux actions in a single Epic of redux-observable middleware. Let's assume I have following Epic. Everytime when SEARCH event happens, Epic loads data from backend and dispatches RESULTS_LOADED action. searchEpic = (action$) => action$ .ofType('SEARCH') .mergeMap( Observable .fromPromise(searchPromise) .map((data) => { return { type: 'RESULTS_LOADED', results: data } }) ) Now, let's assume that I need dispatch additional action when the

Why use Redux-Observable over Redux-Saga?

本秂侑毒 提交于 2019-11-28 13:20:34
问题 I have used Redux-Saga. Code written with it is easy to reason so far, except JS generator function is messing up my head from time to time. From my understanding, Redux-Observable can achieve the similar job that handles side effects but without using generator function. However, docs from Redux-Observable does not provide many opinions of why it is superior against Redux-Saga. I would want to know whether not using generator function is the only benefit of using Redux-Observable. And what