Hi,
I'm new at this too and just experimenting. The model structured is
presented below. I don't think it has much to do with the model, but more
to do with the fact that the update in Child2 is expecting a Child2.Msg,
but is instead receiving a Child1.Msg.
Model Child2
---
model =
{ id: Int
, name: String
, description: String
}
On Sunday, May 29, 2016 at 4:12:59 PM UTC-5, Witold Szczerba wrote:
>
> Hi,
> I am just experimenting with Elm, haven't done anything yet, so I will be
> watching how this thread evolves. Looking at your case, I have but one
> question: what's the model of the component you have problem with?
>
> Regards,
> Witold Szczerba
> 29 maj 2016 21:06 "David" <[email protected] <javascript:>> napisał(a):
>
> I need to update 2 child components based on the Action/Msg of 1 child
> component. How would I do this?
>
> The UpdateFromChild1 contains a Child1.Msg, which contains an id. I'd
> like to send the id to the models of Child1 update *and* to Child2 update
> .
>
> Code:
>
> Main update
> ---
> update msg model =
> case of msg
> UpdateFromChild1 msg ->
> Child1.update msg Child1.model <---- works, update gets correct
> message with id
> Child2.update *msg* Child2.model <---- does not work, obviously
> ^---------------------- somehow change this to
> (Child2.Msg id)?
> UpdateFromChild2 msg ->
> -- stuff only child 2 cares about
>
>
>
> Main view
> ---
> view model =
> div []
> [ App.map UpdateFromChild1 (Child1.view Child1.model)
> , App.map UpdateFromChild2 (Child2.view Child2.model)
> ]
>
> --
> 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] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
--
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.