Josh, won't you experience either message or function explosion doing direct communication like that?
Let's say I have components nested 3 levels deep: MainComponent, which contains AdminComponent, which contains 3 components [ApplesComponent, OrangesComponent, and BananasComponent] Each of the 3 child-most components need to load their respective resource (apples, oranges, and bananas), and display the current loading state (not requested, loading, failed, success) If each of the 3 child components need to proxy requests through the AdminComponent, you're going to get Msgs in the AdminComponent like this: type Msg On Tuesday, July 5, 2016 at 6:13:28 PM UTC-4, Josh Adams wrote: > > I want to understand what you're saying because it seems I'm missing >> something. Let's say we're 3 nested components deep. The deepest child >> wants to load a resource. Rather than creating a http Cmd directly, the >> child should return a message to its parent asking for the resource. That >> parent would then also repeat this process and ask it's parent for the >> resource. Eventually the message arrives at the root component, and the >> root component can generate the Cmd necessary to fetch the resource - >> whether that is from an http request, or a mock service. Is this what >> you're suggesting? >> > > That is, essentially, what I'm suggesting, though others here might > proffer up different ways to get at the same thing. In general, though, I > like thinking of children as just spewing out Msg and having the results of > those flow back into them from the top. > > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
