The app I\'m creating has a lot of entities and relationships (database is relational). To get an idea, there\'re 25+ entities, with any type of relations between them (one-
When you start "overloading" your selectors (like getHealthAuthorsSelector
) with other named selectors (like getHealthAuthorsWithBooksSelector
, ...) you might end up with something like getHealthAuthorsWithBooksWithRelatedBooksSelector
etc etc.
That is not sustainable. I suggest you stick to the high level ones (ie getHealthAuthorsSelector
) and use a mechanism so that their books and the related books of those books etc are always available.
You can use TypeScript and turn the author.books
into a getter, or just work with covenience functions to get the books from the store whenever they are needed. With an action you can combine a get from store with a fetch from db to display (possibly) stale data directly and have Redux/React take care of the visual update once the data is retrieved from the database.
I hadn't heard of this Reselect but it seems like it might be a good way to have all sorts of filters in one place to avoid duplicating code in components.
Simple as they are, they are also easily testable. Business/Domain logic testing is usually a (very?) good idea, especially when you are not a domain expert yourself.
Also keep in mind that a joining of multiple entities into something new is useful from time to time, for example flattening entities so they can be bound easily to a grid control.