ngrx-entity-relationship is a library for Redux and NGRX
which aims to facilitate work with related entities in a normalized store with a simple ORM solution.
It also provides a middleware that can normalize
data and gracefully update the store.
Apart from that, it has helper functions to build GraphQL queries, so, eventually, only selectors should be managed, the rest is done automatically.
The current version of
ngrx-entity-relationship has been tested and can be used with:
Need help or have a suggestion?
- chat on gitter
- ask a question on stackoverflow for Redux solution
- ask a question on stackoverflow for NGRX solution
- report an issue on GitHub
Let's imagine that we have the next models:
Entities of every model are normalized and stored in the store independently:
Now, we want to select from the store an entity of user with the related company and its address. The desired shape should be like that:
Can you believe that the eventual solution is like that?
And, it is able to return any relational data, until there is a configured relationship between entities.
If we use
mapStateToProps and Redux in React, then we could select entities like that:
if we use NGRX in Angular, then we could select entities like that: