Check out example codes for "div resize event typescript". It will help you in understanding the concepts better.

Code Example 1

resizeObservable$: Observable<Event>
resizeSubscription$: Subscription

ngOnInit() {
    this.resizeObservable$ = fromEvent(window, 'resize')
    this.resizeSubscription$ = this.resizeObservable$.subscribe( evt => {
      console.log('event: ', evt)
    })
}

Learn ReactJs, React Native from akashmittal.com