Angular · Signals and RxJS ·
Signals or RxJS: one question
Signals hold a current value, RxJS models events over time. One question to choose between them, and how toSignal() joins the two in a component.
When I pick between signals and RxJS I ask one question: can I say what the value is right now?
A value now: signal
A selected tab or a filtered list always has a current value, so it is a signal. Angular's docs define a signal as a wrapper around a value that notifies interested consumers when that value changes.
Events over time: RxJS
Keystrokes and WebSocket messages are events over time, and that is where RxJS earns its place. Many components need both. Convert once with toSignal() where the stream enters the component and keep the template on signals.
readonly results = toSignal(this.results$, { initialValue: [] });This rule of thumb is my own opinion, not Angular guidance.
Sources
I post short notes like this on LinkedIn.
