Hi everyone firstly ke…

1 minute read

Hi everyone, firstly, keep doing what you’re doing, It’s amazing! In an Angular project, if I have two pages that share multiple reducers, am I best placing those reducers into feature modules And using forFeature or would I better using forRoot?

Responses:

I have this vision in my head that a feature must contain a route of some sort and that reducers must only be used by routes inside the feature they’re declared. 

If it’s best having them as feature reducers, can I assume that features can be used as a way of grouping domain specific stuff and if so, would it make sense to have a library representing each domain, imported by each app library? like so:

You better sharing a facade layer

you using NGRX or NGXS (I’ve personally swapped to NGXS it’s cleaner code)

NGRX: https://medium.com/@thomasburlesonIA/ngrx-facades-better-state-management-82a04b9a1e39

NGXS: https://medium.com/ngxs/ngxs-facade-3aa90c41497b

Thanks. I’ll take a read of these!

I’m using NGRX

With a facade layer, would this be on a “per page / container basis” as such? Or would you use one facade per domain and import the relevant facade’s into your containers / pages?

Here what I do.

I create an interface for facade per domain. In the library i take a library DI Token. Then on the implementation (the app) i assign the NGRX library with the facade to the DI token

Ah ok. Makes sense!

Updated: