Chapter 3. Core operators

 

This chapter covers

  • Introducing disposal of streams
  • Exploring common RxJS operators
  • Building fluent method chains with map, reduce, and filter
  • Additional aggregate operators

In the first two chapters, you learned that RxJS draws inspiration from functional programming and reactive programming. Both paradigms are oriented around data flows and the propagation of change through a chain of functions known as operators. Operators are pure functions that create a new observable based on the current one—the original is unchanged. In this chapter, you’ll learn about some of the most widely used RxJS observable operators that you can use to create a pipeline that transforms a sequence of events into the output you desire.

A common theme in this chapter is creating observables using a declarative style of coding, which originates from FP. You can lift sequences of data of any size into an observable context, as well as data generated or emitted over time, with the goal of creating a unified programming model for any type of data source, static or dynamic. Before we dive into the operators used to apply transformations onto the data that flows through an observable sequence, it’s important to understand that, unlike many AJAX libraries, observables can be cancelled.

3.1. Evaluating and cancelling streams

3.2. Popular RxJS observable operators

3.3. Sequencing operator pipelines with aggregates

3.4. Summary