When you complete a stream, there’s no way to restart it, you must resubscribe. This lesson shows how repeat comes in handy to resubscribe after a stream has completed. Current this block of code: const timer$ = starters$ .switchMap(intervalActions)…
When a stream has completed, you often need to evaluate everything that has happened while the stream was running. This lesson covers how to use reduce to collect values and total up a “score” of this simple game. const Observable = Rx.Observable; co…
This lesson covers how to toggle an observable on and off from another observable by showing how to use a checkbox as a toggle for a stream of data. <!DOCTYPE html> <html> <head> <script src="https://npmcdn.com/@reactivex/rxjs@5.…
You can decouple the parent stream Component from the mapped React Component by using props.children instead. This process involves mapping the stream to React’s cloneElement with the children then passing the props in manually. We have the code belo…
Loading data using RxJS is simple using Observable.ajax. This lesson shows you how to take the ajax response and pass it along the stream to use as props in a React Component. import React from "react" import { render } from "react-dom"…
When you declare your Component and Props in JSX, you can pass those props along to your RxJS stream. This is typically done using switchMap or combineLatest where you can grab from the props from your props$ stream and push them into another stream.…
Operator repeat() is somewhat similar to retry(), but is not for handling operators. In this lesson we learn how repeat works. var foo = Rx.Observable.interval(500) .zip(Rx.Observable.of('a','b','c','d'), (x,y)=>y); var bar = foo.map(x => x.toUpperC…
Higher order Array functions such as filter, map and reduce are great for functional programming, but they can incur performance problems. var ary = [1,2,3,4,5,6]; var res = ary.filter(function(x, i, arr){ console.log("filter: " + x); console.lo…
To help understand your stream, you’ll almost always want to log out some the intermediate values to see how it has progressed during its lifespan. This lesson teaches you how to use do to log values in the middle of the stream without having an impa…
Observables often need to be stopped before they are completed. This lesson shows how to use takeUntil to stop a running timer. Then we use the starting stream and the stopping stream together to create a simple stopwatch. const Observable = Rx.Obser…