Is it possible to pass full store to signalStoreFeature when using withFeature()? #4756
-
I have methods to group and improve readability. Since those methods resides at the top level of the store they need to access various store props, methods, etc. So is it possible to pass store such as: withFeature(store => withTopLevelMethods(store)), Or is this a good idea? Thanks a lot. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
If the argument of If |
Beta Was this translation helpful? Give feedback.
If the argument of
withTopLevelMethods
matches your store, you can do it. ButwithFeature
is more relevant when you are features are decoupled from the actual store and you need to do some mapping between the properties or methods.If
withTopLevelMethods
, on the other side, matches already the partial state, you can also go directly with the input constraints: https://ngrx.io/guide/signals/signal-store/custom-store-features#creating-a-custom-feature-with-input