The difference between Rxjs combineLatest and withLatestFrom

1
940
views

In order to under­stand the dif­fer­ence between a Sub­ject and an Observ­able, you need to be aware of two dis­tinct con­cepts
– A data pro­ducer
– A data consumer

An observ­able, by def­i­n­i­tion, is a data pro­ducer. Albeit a spe­cial kind that can pro­duce data over time.

A Sub­ject, on the other hand, can act as both — a data pro­ducer and a data consumer.

This implies two things.
1. A sub­ject can be sub­scribed to, just like an observ­able.
2. A sub­ject can sub­scribe to other observables.

Read More : http://javascript.tutorialhorizon.com/2017/03/23/rxjs-subject-vs-observable/

1 COMMENT

  1. The difference between combineLatest and withLatestFrom is as follows:
    COMBINE LATEST :
    When using com­bineLat­est, data is pro­duced on the sub­scriber when EITHER of the streams pro­duce data.

    WITHLATESTFROM :
    The with­Lat­est­From method is quite dif­fer­ent instead. You use a pri­mary stream to con­trol when the data is emit­ted on the result.

LEAVE A REPLY

Please enter your comment!
Please enter your name here