Mention :reagent-render in docs, and use it in template.cljs

This commit is contained in:
Dan Holmsand 2015-02-04 22:55:55 +01:00
parent 721e3bab00
commit ac3ed8dbe0
2 changed files with 5 additions and 4 deletions

View File

@ -99,9 +99,10 @@ looking like this:
:component-will-update (fn [this new-argv])
:component-did-update (fn [this old-argv])
: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]
(comp/create-class spec))

View File

@ -133,7 +133,7 @@
{:display-name "ReagentInput"
:component-did-update input-set-value
:component-will-unmount input-unmount
:component-function
:reagent-render
(fn [argv comp jsprops first-child]
(let [this comp/*current-component*]
(input-render-setup this jsprops)
@ -167,7 +167,7 @@
"adapt-react-class instead: " (.' f :type)
(comp/comp-name))
(let [spec (meta f)
withrender (assoc spec :component-function f)
withrender (assoc spec :reagent-render f)
res (comp/create-class withrender)
wrapf (util/cached-react-class res)]
(util/cache-react-class f wrapf)