API Reference
RxJS
Reactive Extensions for JavaScript: composable observable streams for async events, data transformation, and time-based orchestration.
Official Documentation ↗CompatibilityThis documentation covers version
v7.8. Check the official docs for the latest API surface.Installation
npm
npm install rxjspnpm
pnpm add rxjsyarn
yarn add rxjsMethods
No methods match this filter.
RxJS is a library for reactive programming using observables, making it easy to compose asynchronous or callback-based code. It provides a unified API for handling events, promises, timers, and data streams through composable operators.
Key Features
- Observables: Lazy push collections that emit values over time
- Operators: Pure functions for transforming, filtering, and combining streams
- Subjects: Multicast bridges that act as both observer and observable
- Schedulers: Control execution timing and concurrency
- Marble diagrams: Visual testing notation for async behavior
FAQ
- What is the difference between hot and cold observables?
- Cold observables start producing values per subscriber, while hot observables emit regardless of subscribers. Use share() or shareReplay() to make a cold observable hot and multicast to later subscribers.
- How do I avoid memory leaks from subscriptions?
- Store subscriptions in a Subscription object or use takeUntil with a Subject, then call unsubscribe() on component teardown. Angular's AsyncPipe handles this automatically.
- Is RxJS tree-shakeable?
- Yes. RxJS 7+ is fully tree-shakeable when importing operators from 'rxjs' and creation functions from 'rxjs'. Use the pipeable operator API rather than the deprecated prototype patching.
Report a problem with this API docOpens a pre-filled issue on GitHub.