RxJS 7.0.0 is out! Here is a focus on the changes for combining operators. To learn more about this release read the breaking changes and the CHANGELOG.md.
combineLatest
vs combineLatestWith
and zip
vs zipWith
in RxJS 7:
Static functions | Pipeable operators |
---|---|
Notes:
forkJoin
exists only as a static function.withLatestFrom
exists only as a pipeable operator.In RxJS 6, concat
, combineLatest
, race
, zip
pipeable operators were deprecated in favor of the static functions. In RxJS 7, these operators are renamed:
RxJS 6 | RxJS 7 | |
---|---|---|
→ |
The static creation function combineLatest
now supports a dictionary of Observables, like forkJoin
:
import { combineLatest, forkJoin } from "rxjs";
const dictionary = {
color: of("purple", "green"),
shade: of(500, 300),
};
const combined = combineLatest(dictionary);
const joined = forkJoin(dictionary);
// Emitted value example: {color: "purple", shade: 500}
The static creation function zip
now supports an array of Observables, like forkJoin
and combineLatest
:
import { combineLatest, forkJoin, zip } from "rxjs";
const combined = combineLatest([color, shade]);
const joined = forkJoin([color, shade]);
const zipped = zip([color, shade]);
// Emitted value example: ["purple", 500]
Freelance Developer Advocate. Motion graphics with code. JavaScript and Elm. cedricsoulas.com
Receive my latest news, product updates and programming visualizations. You can unsubscribe at any time.