Question presented to candidate:
"We are on Angular 22 and half the team wants to replace RxJS with signals everywhere, the other half wants to keep everything in Observables. Where would you draw the line between signal()/computed()/effect() and RxJS, and how do the two talk to each other?"
What a strong answer should cover:
- Signals model state: a value that always exists, is read synchronously, and notifies dependants.
computed()is lazy, cached and glitch-free;effect()is for side effects. - RxJS models events over time: streams that may emit many times or never, with operators for time (
debounceTime), concurrency and cancellation (switchMap), retries and combination. - The practical split: signals in components and templates; RxJS where time, cancellation or event streams matter (search boxes, websockets, polling, complex HTTP orchestration).
- The bridge:
toSignal()andtoObservable()from@angular/core/rxjs-interop;rxResource(),resource()andhttpResource()(stable in v22) for async data driven by signals. - Differences that bite: a
BehaviorSubjectre-emits equal values while a signal skips them;combineLatestcan emit an intermediate inconsistent value wherecomputed()cannot. - Neither replaces the other: HttpClient, router events and forms still expose Observables.
Clarifying questions expected:
- "Is the goal simpler templates and change detection, or removing the RxJS dependency?"
- "Which parts are event-heavy, such as search, websockets or polling?"
Code / implementation expected: Yes — a search box where the query is a signal, RxJS handles debounce and cancellation, and the result comes back as a signal.