This is something that comes up a lot in the #beginners channel. After 
seeing Cmd.none and Sub.none people instinctively reach for Html.none for 
conditionally rendered parts of the view and are surprised when it doesn't 
exist. 

Using `text ""` is a great practical solution but Html.none is clearer and 
allows the VDOM to avoid adding the extra text node.


On Thursday, 1 September 2016 01:16:30 UTC+2, Nick H wrote:
>
> Evan pointed out on Elm Dev that this is functionality is already 
> available:
>
> none = text ""
>
> but I don't think that solution is very obvious, and agree that adding 
> none to the library would be nice. 
>
> On Wed, Aug 31, 2016 at 4:02 PM, Mark Hamburg <mhamb...@gmail.com 
> <javascript:>> wrote:
>
>> Html.none would produce a virtual DOM node but that node would not 
>> produce anything in the actual DOM. It's usage is an alternative to list 
>> concatenation and empty divs. For example:
>>
>> div []
>>     [ headerView model,
>>     , model.error |> Maybe.map errorBoxView |> Maybe.withDefault Html.none
>>     , bodyView model
>>     ]
>>
>> Now, when diffing the virtual DOM, the header, optional error box, and 
>> body are always at the same indices within the div but we haven't cluttered 
>> the real DOM with empty nodes.
>>
>> Mark
>>
>>
>> --
>> 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 <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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to