Reputation: 437
I am working on a Angular2 app with ngrx (redux). I am wondering... I have some components which react upon app state changes. What is considered to be part of the App State? I have data object (business data) and I also have augmented data, i.e. business objects that are wrapped in another object which deals with presentation things. Example: an array of person wrapped in an object PersonCard (presentation) and augmented with flag properties like 'selected'. Does every state type (domain objects and presentational objects) belong to the AppState (Store)?
Upvotes: 2
Views: 322
Reputation: 4592
Think of the store as your in memory client-side DB, the reducers are tables and actions are queries. There is nothing stopping you from storing a ViewModel in a DB on your server, however it would be considered a blurring of the system boundaries and poor form.
Client side, you deal with ViewModels to support the view. Its perfectly valid to support augmented domain objects in your store, with flags for selected etc. I usually translate dtos to ViewModels via an rx/js map operation when they are fetched. These can then be translated back to the expected structure for persistence on the server.
Upvotes: 1