combineLatest

accepts 2+ input streams, a project function (optional)

  • Whenever any input stream emits a value, it combines the latest values emitted by each input stream

returns a new stream of combined values

zip

accepts 2+ input streams, a project function (optional)

  • It waits for all input streams to have all emitted their n-th value
  • As soon as this condition is met, it combines all those n-th values and emits the n-th combined value

returns a new stream of combined values

Published on Monday, 6 Nov. 2017
Revised on Monday, 8 Oct. 2018

zip vs combineLatest in RxJS

As you can see, ❚ zip produces the first combined value only when both input streams have all emitted their first value.

While ❚ combineLatest combines values whenever any input stream emits a value, ❚ zip only combines each n-th values together.

See also


reduce vs scan

Subscribe to reactive.how newsletter

Receive my latest news, tips and animations:

Learn Reactive Programming and stay up-to-date:
Cédric Soulas

Freelance Developer Advocate. Motion graphics with code. JavaScript and Elm. cedricsoulas.com