In this post, we will learn about one of the most useful RXJS concept Observable.
So, let's get started...
What is Observable?
Observables 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.
Now in very net article, we will learn about how we can create custom observable in rxjs.
Do let me know If you face any difficulties please feel free to comment below we love to help you.
If you have any feedback suggestion then please inform us by commenting.