Hi Everyone I was hopin…

less than 1 minute read

Hi Everyone, I was hoping I could get some clarification on something. I added a component to my library and setup ngrx based on the documentation here: https://nx.dev/angular/guides/misc-ngrx

I ran my initial set up ng g @nrwl/angular:ngrx app --module=apps/<appname>/src/app/app.module.ts --root --minimal

Which sets up everything in my app.module file. Then I add ngrx to my component: ng g @nrwl/angular:ngrx products --module=libs/products/src/lib/products.module.ts --directory +state/products --syntax=creators --defaults

And that sets up the forFeature methods for my product.module.ts store and effects modules but I’m not exactly sure what to put in my StoreModule.forRoot(… method in my app.module. Should it be the same products reducer as the forFeature method? State Management with NgRx


Hey Dubbya,

No if you do not have a root state then this should suffice


since you do not have any root level reducers

and if you are using effects as well and have those regsitered in a feature state the root is just


Ahh perfect, thanks for the clarification. I was driving myself crazy trying to figure out what I should do there.