I'm struggling with understanding how om uses apply to render list items, as shown in the example below taken from the Om tutorial page.
(om/root
(fn [data owner]
(om/component
(apply dom/ul nil
(map (fn [text] (dom/li nil text)) (:list data)))))
app-state
{:target (. js/document (getElementById "app0"))})
My understanding of apply is that it takes a function and a list of items and apply that function to the list. But in this example that understanding would translate to applying dom/ul
to nil
.
The things I don't understand are:
- Why am I applying
dom/ul
to a list, I don't want to createul
elements, I want to createli
elements? - How does apply handle all the parameters sent in this example?