The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Reactive Programming - Clear data while loading with RxJS startWith

Reactive Programming - Clear data while loading with RxJS startWith

6:28
Let's fix a small UI glitch that was occurring on startup and whenever the refresh button was clicked. In this lesson we will see how to avoid common bad habits of imperative programming, and how to use reactive programming to keep the complete dynamic behavior of a value specified in one convenient place.
Watch this lesson now
Avatar
egghead.io

Let's fix a small UI glitch that was occurring on startup and whenever the refresh button was clicked. In this lesson we will see how to avoid common bad habits of imperative programming, and how to use reactive programming to keep the complete dynamic behavior of a value specified in one convenient place.

Avatar
Roaders

Hi. Great videos, many thanks.
Why can't you use start with in the previous lesson to load the initial list of users before the refresh button is pressed rather than merging the 2 streams?

Avatar
Andre

Hi Roaders, we wanted to introduce only one new concept per lesson.

In reply to Roaders
Avatar
Roaders

Great, thanks for the reply.

In reply to Andre
Avatar
Michel

Would you be getting a race condition between getting the response from the requestStream and the null event from the refresh stream?

Avatar
Andre

Hi Michel, no we wouldn't, because from refresh to the null emission, all of this was synchronous, but a response is asynchronous. In worse cases where both are asynchronous, we can still neatly handle race conditions in RxJS using either concat or concatMap or zip, depending on the situation.

In reply to Michel
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?