I agree with rupert, adding a (SmallComponentMsg -> msg)
argument to your views or using Html.map
is architecturally the same thing. It allows you to split your developments into components. Html.map
allows the same kind of flexibility you would get using (SmallComponentMsg -> msg)
functions. You’re not forced to pass a BigAppMsg
constructor to Html.map
, you can pass any function that produces a message to it. Or you could handle particular cases in the update
function of your main application (or bigger component).
So Html.map
and (SmallComponentMsg -> msg)
functions are basically the same thing. The nice thing that Html.map
allows is that, since you’re not forced to add a (SmallComponentMsg -> msg)
parameter to the view function of your component, it’s immediate to use that component as a top level application if you want (the view function has the good signature to be fed to Browser.document
, Browser.application
etc…).