Search code examples
javascriptscalareactive-programmingrxjsreactive-extensions-js

What is the difference between switchLatest and flatmapLastest in RxJs


I am having difficulty in seeing the difference between switchLatest and flatmapLatest in RxJs with the difference being one flattens a nested observable affer the fact like in scala whilst the other is the equivalent of doing it before returning the new flattened collection?

Am I missing something.


Solution

  • .flatMapLatest(func) is equivalent to .map(func).switchLatest(), where func outputs an observable.