rxjs
Reactive programming for JavaScript — compose async event streams with a rich set of operators for transforming, filtering, and combining data over time.
Promises handle one async value. Arrays handle multiple sync values. But multiple async values over time — WebSocket messages, mouse events, polling — don't fit either model. Managing subscriptions, cancellation, and complex event coordination with callbacks leads to spaghetti.
Observable is the core primitive: a lazy push collection. Subscribe to it to receive values. Operators (map, filter, mergeMap, debounceTime) transform streams in a functional pipeline style. Think of it as array methods (.map, .filter) but for values that arrive over time. Subject is both Observable and Observer — useful for multicasting.
Use it when
Angular apps (where it's built-in), complex event handling (drag-and-drop, real-time updates), WebSocket streams, coordinating multiple async operations, auto-completing search inputs with cancellation.
Skip it when
Simple one-off async operations (use async/await), React apps where hooks + SWR/react-query are more idiomatic, or when the team isn't familiar with reactive programming (steep learning curve).
Ready to explore the full API?
See every class, function, and relationship in an interactive graph.