Created
May 3, 2021 08:50
-
-
Save armanozak/7381e87f4309773f6ed9c1d322f813e2 to your computer and use it in GitHub Desktop.
[What's New in RxJS 7] Less memory consumption in higher-order observables #blog #rxjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { of } from "rxjs"; | |
import { map, concatAll } from "rxjs/operators"; | |
of(1, 2, 3) | |
.pipe( | |
map(id => | |
fromFetch(`https://jsonplaceholder.typicode.com/todos/${id}`, { | |
selector: resp => resp.json() | |
}) | |
), | |
concatAll() | |
) | |
.subscribe(todo => console.log(todo.title)); | |
// (after some time) delectus aut autem | |
// (after some time) quis ut nam facilis et officia qui | |
// (after some time) fugiat veniam minus |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment