Nisha Patel
Problem
Current version of Angular and ngrx are 16.0.0.
I started migration to standalone Angular app. So I need to get rid off StoreModule and EffectsModule from app.module.ts. But I can find the way to provide several reducers and relative effects using standalone API's.
Tried different ways to provide but no ones is working as expected. The state is undefined when app tries to read it.
Solution
1. First, make sure you have imported the necessary NgRx modules and your reducers and effects.
2.In your app module, use the provideState() function to provide your root reducers
3. Similarly, use the provideEffects() function to provide your root effects
Suggested blogs:
>Fix: Strange compilation error with Typescript and Angular
>What if the property 'X' does not exist on type 'FastifyContext<unknown>'?
>How to get the type of a class property's getter/setter in TypeScript?
>How to assign multiple const variables in a single declaration in TypeScript?
>Type inference with 'as const' IN TypeScript
>Typescript Return argument: Tuple type or passed to rest parameter warning?
>Why Typescript does not allow a union type in an array?
>Narrow SomeType vs SomeType[]
>Create a function that convert a dynamic Json to a formula in Typescript
>How to destroy a custom object within the use Effect hook in TypeScript?
>How to type the values of an object into a spreadsheet in TypeScript?