Check out example codes for "rxjs create observable from value". It will help you in understanding the concepts better.

Code Example 1

content_copy
      
      
        open_in_new
      
      import { Observable } from 'rxjs'; const foo = new Observable(subscriber => {  console.log('Hello');  subscriber.next(42);  subscriber.next(100);  subscriber.next(200);  setTimeout(() => {    subscriber.next(300); // happens asynchronously  }, 1000);}); console.log('before');foo.subscribe(x => {  console.log(x);});console.log('after');

Code Example 2

// Requires RXJS 6+
// Create an observable of any Type
// Ask yourself if the function creates a new observable or not
// If it creates a new one then it is imported from 'rxjs'
// Operators are imported from 'rxjs/operators'
import { of } from 'rxjs';

// T => Observable<T>
const value$ = of(1);

Learn ReactJs, React Native from akashmittal.com