getItem : GlobalState -> ID -> Tag -> (GlobalState, Cmd msg)
state.items.getItem : ID -> Tag -> (GlobalState, Cmd msg)
update msg model = case msg of
SubMsg m ->
let (newSubModel, subCmds, newGlobalState) = SubComponent.update m model.subModel
in ({ model | state = newGlobalState, subModel = newSubModel}, Sub.map SubMsg subCmds)
...
getItem : ID -> Tag -> Cmd msg
state.items.getItem : ID -> Tag -> Cmd msg
--
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 elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
This is super cool.
But what is the function:
(!) : a -> List b -> (a, b)
Does Elm have best practices for managing and reconciling state between components and global application state managers?
--
You received this message because you are subscribed to a topic in the Google Groups "Elm Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elm-discuss/j-Wa6NGiYUM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elm-discuss...@googlegroups.com.
The problem i see with this approach is that in hierarchy of deeply nested components, the whole ancestry would need to know about the intention of the leaf.
MyModule.elm
type Model =
Model {..}
type alias Config msg = { onClick : msg }
view : Config msg -> Model -> Html msgview config model = button [onClick config.onClick] [text "Submit"]
Parent.elm
type alias Model = { myModuleModel : MyModule.Model }
type Msg = ChildClicked
view : Model -> Html Msgview model = MyModule.view myModuleConfig model.myModuleModel
myModuleConfig : MyModule.Config Msg myModuleConfig = {onClick -> ChildClicked}