Determining the size of a component
As an Om neophyte, you might be wondering what the difference is between building subcomponents and just regular functions that return HTML. Let's look at a hypothetical choice borrowed from our previous todo list example:
(defn todo-item [cursor owner] (dom/div nil (dom/span #js {:className (when (:done? cursor) "done")} (:text )))))cursor)))) (defn todo-list [cursor owner] (reify om/IRender (render [_] (dom/div nil (dom/h1 nil (:text cursor)) (dom/div nil (for [t (:todos cursor)] (todo-item t owner))))))) ```
This is a slightly modified version of our previous todo application. Here, todo-item
is a standard function that happens to return virtual DOM nodes rather than an Om component constructor. It doesn't ...
Get Learning ClojureScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.