The downsides of service driven state
Our tendency when building apps using angular is to bring the data from services, rendering the data in components and passing down values to child components down the components tree.
But this pattern becomes problematic when building big scale apps for the following reasons:
- Intermidiate propery passing – in order to pass state to other child components we need to use @input to pass values down the components tree.
This causes many intermediate components passing value that they aren’t necessarily concerned about.
- Inflexible refactoring – for the previous mentioned reason, we also create coupling between parent and child components, which makes it difficult to place a component somewhere else in the hierarchy because we need to refactor all parents to pass the values.
- State troughout the app - Difficult to get a snapshot of the apps state, and knowing exactly which part of the app holds which state.