1

The state of my TypeScript/Angular app contains objects from the UI layer and from the business domain layer. I'm exploring store-based solutions (eg ngrx, ngxs) to keep this state in memory.

As I understand, such solutions define a single data structure for both UI and business objects, eg

export interface ApplicationState {
uiState: UiState,
domainData: DomainData
}

based on Ngrx Store - An Architecture Guide. This data structure is kept in a single store, injected into UI and other components. Data updates due to user inputs are triggered by UI components emitting actions. Then, reducer functions change both UI and domain data within the ApplicationState.

My question is how to use a single-store solution and not end up with intertwined UI and business data, and with coupled UI and business layers in general.

  • Does combining the UiState and DomainData in ApplicationState imply that the two are coupled?

  • Does providing a UI component with the whole state introduce coupling? Why not provide just the UI state or its relevant part?

  • Would a solution with a separate UI store and a Domain store have a cleaner architecture?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.