This is the exact thing I am stuck on right now in my upgrade to 0.17. It 
is great to see three approaches outlined here, but would it be possible 
for anyone to share some code examples? I am struggling to follow the 
conversation a little bit but seeing some code could clear things up.

On Friday, June 10, 2016 at 1:02:32 PM UTC-4, Andrew Volozhanin wrote:
>
> Hey everyone,
>
> Does anybody know what’s the preferred way to refactor passing context 
> with addresses into child components during migration from Elm 0.16 to 0.17?
>
> In particular, I have *Filter* component that takes context with 2 
> addresses: 
> one for internal actions (Tagged with *UpdateFilter*) and one for 
> “external” action (*Submit*) that is handled outside of the component.
>
> With 0.16, it looked something like this:
>
> type alias Context = { actions: Address Action, submit: Address () }
>
> update action model =
>   case action of
>     UpdateFilter value ->
>       { model | query = value }
>
> view : Context -> Model -> Html
> view = context model
>   form [onSubmit context.submit ()]
>     [ input_ model.query context.actions (\value -> UpdateFilter value)
>   ]
>
>
> But 0.17 doesn’t have addresses anymore, and I’m a bit lost at how should 
> I implement this.
>
> I’ve found example app that is in the middle of the refactoring, that 
> imports necessary “external” actions into the child components directly and 
> sends them, 
> but I don’t like that because it breaks the principle that child shouldn’t 
> know anything about its parent. 
> (See: 
> https://github.com/rogeriochaves/elm-peer-tweet/blob/master/src%2FNewTweet%2FView%2FNewTweet.elm
> )
>
> What’s the best practice in such cases now?
>

-- 
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.

Reply via email to