Like RxJS switchMap() is a shortcut for map() and switch(), we will see in this lesson how mergeMap() is a shortcut for map() and mergeAll(), and learn its arguments for customised behavior.
const clickObservable = Rx.Observable .fromEvent(document, 'click'); function performRequest() { return fetch('https://jsonplaceholder.typicode.com/users/1') .then(res => res.json()); } const emailObservable = clickObservable .mergeMap(click => performRequest(), (click, res) => res.email, // selector function 3); // number of concurrency // mergeMap = map ... + ... mergeAll emailObservable .subscribe(email => console.log(email));