
Reactive Patterns with RxJS for Angular
By :

I think you might have guessed the first advantage: we don't have to manually manage subscriptions and unsubscriptions, and what a relief! But there are a lot of other advantages; it is not only about the async pipe. Let's look at the other advantages in more detail.
Let's shed light on the fact that we don't explicitly use the subscribe()
method. What's wrong with subscribe()
? Well, subscribing to a stream inside our component means we are allowing imperative code to leak into our functional and reactive code. Using the RxJS observables does not make your code reactive and declarative systematically. But what does declarative mean exactly?
Well, first, we will nail down some key terms. Then, let's iterate from there: