Skip to content

defcomp

jiyinyiyong edited this page Apr 4, 2020 · 6 revisions

defcomp

(defcomp comp-demo [content]
  (div
    {:class-name "demo-container"
     :style {:color :red}}
    (<> content)))

defcomp is a Macro(https://github.com/Respo/respo/blob/master/macros/respo/core.clj) transforming code to:

(defn comp-comp [content]
  (merge respo.schema/component
    {:args (list content),
     :name :comp-name,
     :render (fn [content]
                 (div
                   {:class-name "demo-container"
                    :style {:color :red}}
                   (<> content)))})))
Clone this wiki locally