Why didn’t the Angular team choose RxJS over Signals?

Posted by



When it comes to managing asynchronous data flows in web applications, RxJS and Signals are two popular solutions that developers turn to. Both offer powerful tools for handling complex asynchronous operations, and can greatly simplify the process of working with data streams in Angular applications.

While RxJS has become the de facto standard for managing asynchronous data streams in Angular applications, some may wonder why the Angular team didn’t simply use RxJS instead of Signals. In this tutorial, we will explore the reasons behind this decision and discuss the benefits of using Signals in Angular applications.

Before we dive into the reasons behind the Angular team’s decision, let’s first take a closer look at RxJS and Signals to understand what they bring to the table.

RxJS is a powerful library for reactive programming in JavaScript, and is widely used in Angular applications for managing asynchronous data flows. It provides a rich set of operators that allow developers to work with reactive streams of data, and offers powerful tools for handling complex asynchronous operations such as data fetching, event handling, and state management.

On the other hand, Signals is a lightweight library for managing asynchronous data flows in Angular applications. It provides a simple and intuitive API for working with data streams and offers a more streamlined approach to handling asynchronous operations compared to RxJS.

So why didn’t the Angular team just use RxJS instead of Signals? There are several reasons behind this decision, which include:

1. Performance: Signals is designed to be lightweight and optimized for performance in Angular applications. By using a smaller library like Signals instead of RxJS, the Angular team was able to reduce the size of the framework and improve the overall performance of Angular applications.

2. Simplicity: Signals offers a simpler and more intuitive API compared to RxJS, making it easier for developers to work with asynchronous data streams in Angular applications. This can lead to faster development times and a smoother learning curve for developers new to Angular.

3. Integration: Signals is designed to work seamlessly with Angular’s existing architecture and best practices. By using Signals instead of RxJS, the Angular team was able to ensure a more seamless integration with the Angular framework and provide a more consistent experience for developers working on Angular applications.

4. Angular Compatibility: Signals is specifically designed to work with Angular and leverage its features and conventions. By using Signals instead of RxJS, the Angular team was able to ensure better compatibility and interoperability with Angular’s core features and tools.

In summary, while RxJS is a powerful and widely-used library for managing asynchronous data flows in Angular applications, there are several reasons why the Angular team chose to use Signals instead. By opting for Signals, the Angular team was able to create a more streamlined and optimized solution for handling asynchronous operations in Angular applications, while still providing developers with the tools they need to effectively manage complex data streams.

0 0 votes
Article Rating
30 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@JoshuaMorony
1 month ago

Join my mailing list for more exclusive content and access to the archive of my private tips of the week: https://mobirony.ck.page/4a331b9076

@SvjeGehjdk
1 month ago

Garcia Carol Clark George Anderson Patricia

@4444-c4s
1 month ago

Kya Faaltu ka Framework hai…
Jo applications already ban chuke hai usme bhi kya Signals add karne jaayenge??
Aur jitne bhi naye applications ban rahe hai usme bhala Angular kon use karega?

@eswarbalasubramanian129
1 month ago

When I turn on subtitles, some code below got hidden beside it. Please keep the code up. Thanks. Nice video with great explanation

@ml_serenity
1 month ago

Signals sound a lot like good old React's useState().

@L-Lesiv
1 month ago

Grate explanation!

@Joao.Costa.5504
1 month ago

Basdasdas

@manish.pradhan
1 month ago

Really eye opening. Thanks a bunch.

@tarquin161234
1 month ago

Some really good points – thank you.
One of your criticisms of rxjs is the transient values caused by the combineLatest diamond problem (which can be solved by debounceTime btw), but signals actually cause the same thing with the initial value required by toSignal().
Also, we have the new component input signals, but what if I want to debounceTime() or throttle()? I would have to convert to observable and back to signal…

@cpm2k
1 month ago

Excellent explanation. The simpler, the better. You don't have to be a specialist to write good apps.

@RasmusSchultz
1 month ago

from my perspective, Signals just adds yet another chunk of learning curve and complexity to what is arguably already the most complex, most difficult framework out there. If Signals could actually replace RxJS, that would be one thing, but they can't – as you said, they only cover a subset of what you can do with Observables. So you still need to learn RxJS if you want to build anything bigger than a todo list. What they should have done instead is either (A) solve the ergonomic problems with RxJS, or (B) go all-in on Signals as a total replacement for everything you can do with RxJS.

Just throwing Signals into the mix only puts off the learning you will eventually need to do anyway to build something substantial with Angular. This doesn't feel like a serious feature – it looks more like a marketing ploy to ride on the success of newer frameworks that go all-in on Signals. This might temp people to onboard Angular, but will likely still lead to the same amount of bafflement and overwhelm when, inevitably, they will need to reach for RxJS for something and we're right back where we were before: still the most difficult framework there is.

@enverusta7811
1 month ago

The only thing I couldn't understand is why did you compare `computed` with `combineLatest`? I think it's not the equivalent of `computed` in rxjs world. If you'd like to update the base value after both observable's emission maybe you could use `zip` or something. What do you think?

@diadetediotedio6918
1 month ago

There is also the case for signals being less costly as they will not necessarily update once the dependent value changes, but only when pulled.

@mostafavii
1 month ago

NICE and brief explanation, thanks

@elavarasu1921
1 month ago

While all these are good points…
The real question some developers like me have is NOT 'why can't the developers use behavioursubject instead of signals'.
it's "Why doesn't ANGULAR team create their own version of signals with behaviour subjects and mitigate the gotchas of rxjs, and give us a clean signals like feature which we can use without worrying about using new rxjs operators, subscription or unsubscription etc.

They found something better than rxjs and instead of doing a bit of extra work to add those benefits with the existing tools they have, they simply decided to add it to angular and leave the learning part to the developers…

One of the issues already with Angular is that it's too hard to learn, this adds to it deterring new adopters even more….

@astasyk
1 month ago

Could you share how signals avoid the diamond problem? I found a comment under an article on Angular's signals that said that even Solid.js signals do not avoid this problem. Are Angular's signals somehow different?
From the piece of code I still see two separate updates first of one value then of another which look like the derived value should first react to the first value update and then the second. But maybe I don't know something about the inner working of these signals.

@saaalut
1 month ago

Removing Zone.js …

@berealistic2703
1 month ago

Thanks!

@piano42
1 month ago

Worked with RxJS in the past, then stores in svelte and now finally signals have arrived.

Functional programming is generally a good idea but was never a fan of RxJS overcomplicated and unintuitive concept. Big fan of clean code principles like KISS. And that's what svelte and angular signal does.

@jan6370
1 month ago

I wish RxJS would just not use the plain Observable as an abstraction for everything. Other FRP approaches embrace the difference between signals (reactive state), flows (discrete streams without state) and tasks (producers of just a single value). Yes, we now have this holy trinity in the shape of Signals, Observables and Promises, but these three things all come with their own rules and syntax and require conversions to be used together.