What is PassthroughSubject & CurrentValueSubject

I think we can make analogies with real world cases.

PassthroughSubject = A doorbell push button

When someone rings the door, you are notified only if you are at home (you are the subscriber)

PassthroughSubject doesn’t have a state, it emits whatever it receives to its subscribers.

CurrentValueSubject = A light switch
Someone turns on the lights in your home when you are outside. You get back home and you know someone has turned them on.

CurrentValueSubject has an initial state, it retains the data you put in as its state.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)