IThoughtItWouldBeEasy
IThoughtItWouldBeEasy

Reputation: 51

Angular ngrx store and AWS Amplify API (Appsync) for GraphQL

I am looking to use AWS Amplify API within an Angular App which is using the ngrx store for State Management.

I can be flexible in the approach but cannot find much documentation regarding a "preferred" approach or indeed whether I should be pursuing it this way.

The vision was to have one application store for state (ngrx) so the approach was to use actions to ngrx to trigger mutation instructions or data fetches and store the data received in the ngrx store. The app then displays data from this store. If I continue with this approach then I am unsure on the best approach for subscription management - I am thinking of using a side effect to create the subscription then generate new actions on the store as data is received.

Does anyone know of any best practice guidelines for AWS Amplify API and ngrx working in tandem?

Thanks

Upvotes: 0

Views: 610

Answers (1)

Ritesh Waghela
Ritesh Waghela

Reputation: 3727

Please take a look at this:

https://blog.angularindepth.com/start-using-ngrx-effects-for-this-e0b2bd9da165

You can use ngrx effects, this way you will have no side effect to create a subscription while calling the API.

Upvotes: 0

Related Questions