Fork me on GitHub

This might be a noobie question but I’m wondering what would be the “recommended way” to create a reagent component which “takes as input” 2 other components and displays one or the other depending on some internal state. For example:

(defn hello-a [] [:div "a"])
(defn hello-b [] [:div "b"])

(def possibly-true? (zero? (rand-int 2)))

(defn choose-a-or-b
  [{:keys [view-1 view-2]
  (if possibly-true?

(defn home-page
  [choose-a-or-b {:view-1 hello-a :view-2 hello-b}])


Your code is just fine. A regular HOC.