Let's take a look at an example using RxJS.
Type X: [utilizing filter]
this.userService.afAuth.authState
.pipe(filter(user => !!user))
.subscribe( _ => this.router.navigate(["/anything"]) )
Type Y: [utilizing if statement]
this.userService.afAuth.authState
.subscribe( user => {
if(!!user) this.router.navigate(["/anything"])
})
Question 1: How can we evaluate the performance of these two approaches?
Question 2: Which method is recommended and for what reasons?