clojurescript - Unable to display two components in OM -
i attempting learn om, , have come across don't understand. expect code
(defn search-page-view [app owner] (reify om/irender (render [_] (dom/div #js {:id "search-block"} "test") (dom/div #js {:id "results-block"} "test2")))) (om/root search-page-view app-state {:target (. js/document (getelementbyid "app"))})
to result in html:
<div id="app> <div id="search-block"> test </div> <div id="results-block"> test2 </div> </div>
however, not! first div
containing test not display. misunderstanding?
edit solution (pointed out fakerainbrigand):
changing code
(defn search-page-view [app owner] (reify om/irender (render [_] (dom/div nil (dom/div #js {:id "search-block"} "test") (dom/div #js {:id "results-block"} "test2")))))
results in expected html.
as explained here , fakerainbrigand explained, render function must return single renderable.
Comments
Post a Comment