RxJs: withLatestFrom

jastya

Tejas

Posted on September 10, 2021

RxJs: withLatestFrom

Hi all, in this post we will learn how we can use RxJs withLatestFrom operator.

Let's say we have 2 observables bs1, bs2. We are interested in getting notified whenever bs1 streams any data. Also, we want to consider latest value streamed by bs2 whenever bs1 streams data. In this case we can make use of withLatestFrom.

We subscribe to bs1 & use withLatestFrom(bs2).

Use this stackBlitz link to get an example: https://stackblitz.com/edit/rxjs-uhrmor?devtoolsheight=60
You need to observe the console logs to understand the use of withLatestFrom.

I hope this helps.

Thanks!!

💖 💪 🙅 🚩
jastya
Tejas

Posted on September 10, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

RxJs: withLatestFrom
rxjs RxJs: withLatestFrom

September 10, 2021