Tuesday, June 26, 2018

tap is for a side effect in NgRx

We are tapping into something here:

this.foo = this.store.select(mySelector).pipe(tap(m => this.model = m));

 
 

It is a "while you are passing through, do this too" bolt on. The .pipe code here will never run until there is a subscription to foo or perhaps foo is used with the async pipe in component template markup.

No comments:

Post a Comment