Introduction to the RxJS Subject Class

Get an introduction to Subject, which is a special type of Observable that implements both Observer and Observable types.

A Subject is a type that implements both the Observer and Observable types. As an Observer, it can subscribe to Observables, and as an Observable, it can produce values and have Observers subscribe to it.

In some scenarios, a single Subject can do the work of a combination of Observers and Observables. For example, to make a proxy object between a data source and the Subject’s listeners, we could use this:

Get hands-on with 1400+ tech skills courses.