mirror of https://github.com/status-im/reagent.git
Mention :reagent-render in docs, and use it in template.cljs
This commit is contained in:
parent
721e3bab00
commit
ac3ed8dbe0
|
@ -99,9 +99,10 @@ looking like this:
|
||||||
:component-will-update (fn [this new-argv])
|
:component-will-update (fn [this new-argv])
|
||||||
:component-did-update (fn [this old-argv])
|
:component-did-update (fn [this old-argv])
|
||||||
:component-will-unmount (fn [this])
|
:component-will-unmount (fn [this])
|
||||||
:render (fn [this])}
|
:reagent-render (fn [args....]) ;; or :render (fn [this])
|
||||||
|
}
|
||||||
|
|
||||||
Everything is optional, except :render.
|
Everything is optional, except either :reagent-render or :render.
|
||||||
"
|
"
|
||||||
[spec]
|
[spec]
|
||||||
(comp/create-class spec))
|
(comp/create-class spec))
|
||||||
|
|
|
@ -133,7 +133,7 @@
|
||||||
{:display-name "ReagentInput"
|
{:display-name "ReagentInput"
|
||||||
:component-did-update input-set-value
|
:component-did-update input-set-value
|
||||||
:component-will-unmount input-unmount
|
:component-will-unmount input-unmount
|
||||||
:component-function
|
:reagent-render
|
||||||
(fn [argv comp jsprops first-child]
|
(fn [argv comp jsprops first-child]
|
||||||
(let [this comp/*current-component*]
|
(let [this comp/*current-component*]
|
||||||
(input-render-setup this jsprops)
|
(input-render-setup this jsprops)
|
||||||
|
@ -167,7 +167,7 @@
|
||||||
"adapt-react-class instead: " (.' f :type)
|
"adapt-react-class instead: " (.' f :type)
|
||||||
(comp/comp-name))
|
(comp/comp-name))
|
||||||
(let [spec (meta f)
|
(let [spec (meta f)
|
||||||
withrender (assoc spec :component-function f)
|
withrender (assoc spec :reagent-render f)
|
||||||
res (comp/create-class withrender)
|
res (comp/create-class withrender)
|
||||||
wrapf (util/cached-react-class res)]
|
wrapf (util/cached-react-class res)]
|
||||||
(util/cache-react-class f wrapf)
|
(util/cache-react-class f wrapf)
|
||||||
|
|
Loading…
Reference in New Issue