Home > Software design >  Angular ngrx component store .select method
Angular ngrx component store .select method

Time:03-31

I am trying to find the .select method of ngrx but I cannot really find details on it on internet. What I need is to find out about the overloads of this .select() method. Like, the simplest form is

.select(state => state.someSlice)

But I saw also

.select(p1, p2, (p1, p2) => someFunction(p1, p2));

and similar. Is p1, p2 necessarily an observables? I need some documentation on this. This is the ngrx version that is in my package.json:

"@ngrx/component-store": "^10.0.0",

CodePudding user response:

the documentation isn't great on this, but the difference is in v1 you're just selecting some property of the state with a standard map function.

but in the second, you're feeding two selectors and the third argument is a map function to combine the result of those two selectors.

select docs are here: https://v10.ngrx.io/api/store/select

but the more useful docs are here: https://v10.ngrx.io/guide/component-store/read

  • Related