Understand how RxJS Observables and Subjects work and what’s the difference between them

Radoslaw Fabisiak
Duomly - Online School
9 min readSep 1, 2020

--

RxJS: Observables vs Subjects

This article was originally published at https://www.blog.duomly.com//rxjs-observables-vs-subjects/

Intro to RxJS Observable vs Subject

RxJS is one of the most useful and the most popular libraries when using Angular as the main framework for your project. RxJS provides two types of Observables, which are used for streaming data in Angular.

For most beginners, who just started with Angular, Observables are the biggest source of frustration; it’s confusing and not easy to understand. Personally, I felt the same; when I started with RxJS, it was confusing.

That’s why I’d decided to create an article where I’ll go through the RxJS library and will describe the most important concepts, with a big focus on Observables ad Subjects. I’ll explain how it works, why it’s good to use it, and what is the difference between Observable and Subject.

Let’s start!

What is RxJS?

RxJS is a library supporting reactive programming, very often used with an Angular framework. It provides an Observable class that helps to compose asynchronous and event-based programs. Besides Observable, RxJS comes with operators for handling…

--

--