Tell me please what is the best way to communicate data between components in angular if you use Ngrx Store.
For example Component1 -> send data to -> Component2. After some time business tell me add new service, so I decide to create a new Component3 and add it between them.
So now I have to modify data flow. Component1 -> Component3 -> Component2.
So in which way it would be more code clean and simple to understand, with input outpt
or despatch(action) ofType(action)
?
i think it depends on the size of your app and how many levels you have between components, imagine that you have a child5 component that have to communicate with child1, in that case it's not a good idea to use Input Output, on the picture bellow, if child component have to communicate to Grandparent it has to pass by Parent, the Parent participate in the flow even if it doesn't have anything to do with that data
better way here is to use Subject and create and EventBus, check my answer here https://stackoverflow.com/a/56291422/4399281
Ngrx store is the best options but if you really need it, don't implement a state management if you have few components only