DEV Community

Cover image for 3 things you need to know about RxJS
Lorenzo Zarantonello for This is Learning

Posted on • Updated on • Originally published at vitainbeta.org

 

3 things you need to know about RxJS

This post is a super brief summary of the RxJS fundamentals. If you are interested in RxJS, read the complete article on Medium, where I added a short example.

But first, let's dive into the three things you need to know about RxJS.

1. RxJS is a JavaScript library

RxJS stands for Reactive Extensions for JavaScript.

According to the official documentation, "RxJS is a library for composing asynchronous and event-based programs by using observable sequences".

In other words, RxJS is a library that helps us manage and manipulate data over time.

2. RxJS offers some advantages over Promises

RxJS offers several advantages compared to traditional techniques like Promises. Here are two key advantages:

  • RxJS can produce multiple values over time
  • Unlike Promises, it is possible to cancel async operations before they terminate

3. RxJS share some principles with Reactive Programming

Reactive programming is simply programming with asynchronous data streams. Anything can be a stream: variables, user inputs, data structure, etc. Therefore, it is possible to listen to the stream and react appropriately.

When we combine the functional paradigm with reactive programming we want to dynamically specify the behavior of values when we declare them.

Thanks to RxJS operators, we get a set of tools to merge, filter, and manipulate data streams.

Being a very short intro, there are no examples nor code. But at least you have some idea about RxJS. If you are interested, learn more about RxJS.

Top comments (0)

typescript

11 Tips That Make You a Better Typescript Programmer

1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields

...

Read the whole post now!