Skip to main content

Reactive programming, Observables and Observers

Learn Reactive programming, Observables and Observers (Module 12 · RxJS, Angular) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Streams over time • Reactive programming means describing what should happen when data arrives, instead of asking for it. Compare a Java List (all values exist now) with a stream of events (values arrive over time): clicks, keystrokes, HTTP responses. • RxJS (Reactive Extensions for JavaScript) is the library that models these as Observables . Angular uses it in HttpClient, Router, forms and more. • An Observable is a lazy stream, like a YouTube channel: nothing happens until someone subscribes. The Observer is the subscriber with three callbacks: next (a value), error (failed) and complete...

More lessons in Module 12 · RxJS