Skip to content

Instantly share code, notes, and snippets.

@armanozak
Created May 3, 2021 08:50
Show Gist options
  • Save armanozak/7381e87f4309773f6ed9c1d322f813e2 to your computer and use it in GitHub Desktop.
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
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