-
Hi everyone, I am new to TCA and I am already loving it for the benefits it offers. I was trying to make a clone of Facebook social home feed. So I was thinking to structure it like this
But the problem I am facing is I don't know how to make array of child states within the parent and derive the corrsesponding store to pass to the child. I saw in CounterFeature example mentioned in documentation, but that was only one child. But how do I deal with array of child states and actions and eventually derive a store to initialise the corresponding child. Can you guys please help me in pointing to any TCA concept that can fix this elegantly? Or any sugesstions in terms of modelling. Thanks you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The way you do this is have the parent hold an In the case studies in this repository, there are several examples having to do with lists. Have a look at those. |
Beta Was this translation helpful? Give feedback.
The way you do this is have the parent hold an
IdentifiedArray<ChildFeature.State>
in its state and have an action casechildAction(IdentifiedAction<ChildFeature.Action>)
. Then in your reducer body, there is a.forEach()
operator you point at this state and action and the child reducer.In the case studies in this repository, there are several examples having to do with lists. Have a look at those.