clojurescriptreagentre-frame

Render two components in reagent / reframe


I have some code:

(defn second-panel []
    [:div
     [:h1 "Hello "]
     ])

(defn root-container []
  (second-panel)
  (let [name (re-frame/subscribe [::subs/name])]
    [:div
     [:h1 "Hello from " @name]
     ]))

but only the root-container component renders. Why is my second-panel function not rendering?


Solution

  • You have to add (second-panel) to your div. The return value of (second-panel) is currently ignored.

    (defn root-container []
      (let [name (re-frame/subscribe [::subs/name])]
        [:div
         (second-panel)
         [:h1 "Hello from " @name]
         ]))