is programming with asynchronous data streams. That means turn every async event : • actions (in our use-case) • data from server • callbacks • … Into a stream
complete events. You can listen them, so you can use the “observer” design pattern. An observable in JS has the subscribe method that looks like this: MyObservable.subscribe( () => { callback for new values}, () => {callback for errors}, () => {callback when complete} )
be used as an input to another one. Even multiple streams can be used as inputs to another stream. You can merge two streams. You can filter a stream to get another one that has only those events you are interested in. You can map data values from one stream to another new one.
converts a promise into an Observable. NOTE: a promise is an observable that emits only one value, or error. Most of the operators work with observable and promises
an observable sequence based on a predicate. This is an alias for the where method. NOTE: transformation operators syntax: stream1.filter().map().do().scan()...
the items emitted by an Observable into Observables, then flatten the emissions from those into a single Observable switchMap has implicit cancellation, when new object received
from an Observable that pass a predicate test • Debounce — only emit an item from an Observable if a particular timespan has passed without it emitting Combining • Join — combine items emitted by two Observables whenever an item from one Observable is emitted during a time window defined according to an item emitted by the other Observable 60 operators (have to use less than 20) reference: http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html
creation of the source). We will not go deep into this aspect and not inside subscription. In our environment, the lib will take care about these aspects.
to observe the stream of actions coming from the store and dispatch new actions. No need to subscribe, the middleware does it for you. Only thing to do is write an Epic reference: https://redux-observable.js.org/ API V5 http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html (it uses hot observables internally but you don’t have to care about it)
a stream of actions and returns a stream of actions. Actions in, actions out. You can think of it of having roughly this type signature: function (action$: Observable<Action>, store: Store): Observable<Action>;
immediately dispatched through the normal store.dispatch(), so under the hood redux-observable effectively does epic(actions$, store).subscribe(store.dispatch) Epics run alongside the normal Redux dispatch channel, after the reducers have already received them--so you cannot "swallow" an incoming action. Actions always run through your reducers before your Epics even receive them.
the RxJS operators to the Observable.prototype so you will need to import the ones you use or import all of them in your entry file. • Epics run alongside the normal Redux dispatch channel, after the reducers have already received them. When you map an action to another one, you are not preventing the original action from reaching the reducers; that action has already been through them!
a function that returns a declaration of how to react to the events. The epic is executed once, to initialize the observables and subscribe. It defines the pipeline, the final in/out values are the actions. Don't be afraid, it is very simple and fast, after playing with it Less trivial notes