Rename :component-function to :reagent-render

But keep :component-function as alias for the time being
This commit is contained in:
Dan Holmsand 2015-02-04 22:45:39 +01:00
parent c862792624
commit 017fa9c106
2 changed files with 10 additions and 5 deletions

View File

@ -28,7 +28,7 @@
(let [f (.' c :cljsRender)
_ (assert (ifn? f))
p (.' c :props)
res (if (nil? (.' c :componentFunction))
res (if (nil? (.' c :reagentRender))
(f c)
(let [argv (.' p :argv)
n (count argv)]
@ -118,7 +118,7 @@
(this-as c (apply f c args)))
f))
(def dont-wrap #{:cljsRender :render :componentFunction :cljsName})
(def dont-wrap #{:cljsRender :render :reagentRender :cljsName})
(defn dont-bind [f]
(if (fn? f)
@ -157,8 +157,13 @@
(assoc fm :cljsName (fn [] name))
fm)))
(defn wrap-funs [fun-map]
(let [render-fun (or (:componentFunction fun-map)
(defn wrap-funs [fmap]
(let [fun-map (if-some [cf (:componentFunction fmap)]
(-> fmap
(assoc :reagentRender cf)
(dissoc :componentFunction))
fmap)
render-fun (or (:reagentRender fun-map)
(:render fun-map))
_ (assert (ifn? render-fun)
(str "Render must be a function, not "

View File

@ -76,7 +76,7 @@
self (atom nil)
comp (reagent/create-class
{:get-initial-state (fn [] {:foo "initial"})
:render
:reagent-render
(fn []
(let [this (reagent/current-component)]
(reset! self this)