Stephen Romero
Stephen Romero

Reputation: 3032

NgRx: Is the RxJS pipe operator necessary for store.select?

I came across a piece of code that had a pipe operator, but there wasn't a chain. Is it necessary? or any benefit to it at all?

with pipe

this.store.pipe(select(currentUser)).subscribe(authState => {});

without pipe

this.store.select(currentUser).subscribe(authState => {});

Upvotes: 4

Views: 5237

Answers (1)

martin
martin

Reputation: 96969

Well, this is a bit confusing. in NgRx 6 the select() method was deprecated in favor of select() operator. https://github.com/ngrx/platform/blob/6.1.2/modules/store/src/store.ts#L22-L24.

However, since NgRx 7 it was un-deprecated:

The official doc for NgRx is using the select() operator but people in #1361 recommend using the select() method.

Upvotes: 4

Related Questions