Question - What are the differences between Subject, BehaviorSubject and ReplaySubject in RxJS?
Answer -
Subject
In the RxJS Subject, Observers who are subscribed later do not obtain the data values emitted before their subscription.
ReplaySubject
In RxJS ReplaySubject, Observers who are subscribed at a later point receives data values issued before their subscription. It operates by using a buffer that holds the values emitted and re-emits them once new Observers are subscribed.
BehaviorSubject
BehaviorSubject functions similar to ReplaySubject but only re-issues the last emitted values. So, it should be used when you are interested in the observer's last/current value.