Let's say that you have a Parent + ChidA & ChildB. If you want ChildA to have an effect on ChildB, the best way to do it is to send this effect upstream to the parent by extending the update return `update : Msg -> Model -> (Model, SomeEffectRequest)` The parent should have a way to convert SomeEffectRequest into a Cmd. When the message from that Cmd will arrive, the parent will be able to update all the children that need that information (in your case both children)
On Fri, Jun 3, 2016 at 4:58 AM, 诺铁 <[email protected]> wrote: > hi, > > I want to make some component parts, instead of a complete component. > for example, I have a search bar, it will send user input query to backend > service, and then extract data from response Json(this can be done by using > Cmd Msg), then I will wrap the data in a List SomeData, but I want to let > other component show this SomeData, that is, I want to user SomeData as > another unknown component's Msg. > > I will use a parent component to combine the two. the author of parent > component can even choose from multiple components which can show SomeData. > > current examples seems only covers nesting. any hints? > > -- > 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. > -- There is NO FATE, we are the creators. blog: http://damoc.ro/ -- 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.
