(defc & body)
Defc does couple of things:
1. Wraps body into sablono/compile-html
2. Generates render function from that
3. Takes render function and mixins, builds React class from them
4. Using that class, generates constructor fn [args]->ReactElement
5. Defines top-level var with provided name and assigns ctor to it
(rum/defc label [t]
[:div t])
;; creates React class
;; defines ctor fn (defn label [t] ...) => element
(label "text") ;; => returns React element built with label class
Usage:
(defc name doc-string? [< mixins+]? [params*] render-body+)
Source
(defmacro defc
"Defc does couple of things:
1. Wraps body into sablono/compile-html
2. Generates render function from that
3. Takes render function and mixins, builds React class from them
4. Using that class, generates constructor fn [args]->ReactElement
5. Defines top-level var with provided name and assigns ctor to it
(rum/defc label [t]
[:div t])
;; creates React class
;; defines ctor fn (defn label [t] ...) => element
(label \"text\") ;; => returns React element built with label class
Usage:
(defc name doc-string? [< mixins+]? [params*] render-body+)"
[& body]
(-defc 'rum.core/build-defc (boolean (:ns &env)) body))