You are building a real-time dashboard that fetches data from multiple sources. You want to update the UI as soon as any of the data sources emit a new value. Which RxJS operator would be most suitable for this use case?

  • concatMap
  • exhaustMap
  • mergeMap
  • switchMap
In this scenario, you should use switchMap, which switches to the latest observable whenever a new one arrives, effectively updating the UI as soon as any source emits new data.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *