Observable in rxJS

Observable in rxJS

What is Observable?

Obserbales is the most important topic of RXJS

Observables' introduced in RXJS

An Observable is just a function with a few special characteristics

What is an observer?

We need to subscribe to observable to use it, which called observer

  When an Observable produces values, it then informs the observer, calling .next() when a new value was successfully captured and .error() when an error occurs.  

  When we subscribe to an Observable, it will keep passing any values to an observer until one of two things happens. Either the producer says there are no more values to be sent, in which case it will call .complete() on our observer, or we (as the “consumers”) decide we are no longer interested in the values and we unsubscribe.

  

What is an operator?

An operator is a function that creates a new observable based on the input observed. The purpose of the operator, to modify or filter originally emitted values in the way we need for the project tasks.

We can say Operators are basically pure functions, that transform information into the observables stream

The operator always creates new observables, based on the current observables.

we can also use multiple operators in one method using the pipe() method which is also known as a Channing of Operators.

Operators are by nature immutable

Subscribe to our Newsletter

Stay up to date! Get all the latest posts delivered straight to your inbox.

If You Appreciate What We Do Here On TutsCoder, You Should Consider:

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

You might also like

Leave a Comment