DEV Community

Discussion on: Don't follow RxJS Best Practices

Collapse
 
halcaponey profile image
halcaponey
getUser().pipe(
  switchMap(user => getDetails(user)),
  switchMap(details => getPosts(details)),
  switchMap(posts => getComments(details)),
)

should be

getUser().pipe(
  switchMap(user => getDetails(user)),
  switchMap(details => getPosts(details)),
  switchMap(posts => getComments(posts)),
)

but really should be

getUser().pipe(
  switchMap(getDetails),
  switchMap(getPosts),
  switchMap(getComments),
)

Good article, made me smile

Collapse
 
nikpoltoratsky profile image
Nik Poltoratsky

Thank you! Fixed