RxJS: A Simple Introduction

Introducing ReactiveX and the observer pattern for Javascript applications

Ross Bulat

--

ReactiveX: Asynchronous, Event-Based Programming

Modern web apps of today are heavily event-driven, meaning they react to (and rely on) a range of external services and data sources to make them tick. One of the core libraries to make this happen is ReactiveX, also known as Reactive Extensions.

The ReactiveX library has been implemented in a range of languages, the most widely adopted of which being RxJS, the Javascript implementation. RxJS is particularly useful as it can be integrated within any Javascript application, whether server or client side, that has attributed to its huge growth in adoption.

This article aims to explain how RxJS works and how to leverage it in your projects in around a 10 minute read, covering the key concepts and terminology used along the way. Let’s get started.

The state of RxJS

The rsjx(npmjs) package, currently on version 6, is seeing huge popularity on 10.5 million weekly downloads at the time of writing. This popularity can be equated to a range of factors:

  • The package only has one dependency, tslib, providing Typescript support. The lack of dependencies means it is extremely easy to adopt RxJS as a dependency itself for other packages, allowing for a whole host of use cases including utility packages, API SDKs, webhook implementations and server side programs, as well as front-end event managers
  • The package is well maintained and is regularly updated, making it a reliable codebase. Version 6 (released in April 2018) was a huge update from the previous version that strengthened the library’s modularity and performance, showing the dev team are committed to long term success while not being averse to refactoring where it makes sense
  • Interestingly, RxJS makes a lot of sense for blockchain applications and the FinTech sector in general. Dapps in particular rely on continuous feedback from blockchains to process transaction data and events. RxJS is also a great fit with centralised services for managing transaction processing
  • Live chat and real-time…

--

--

Ross Bulat

Programmer and Author. @ Parity Technologies, JKRB Investments