Reuse render function between components

This commit is contained in:
Dan Holmsand 2014-11-22 17:05:43 +01:00
parent e4617bcaf6
commit 7d79637de6
1 changed files with 8 additions and 5 deletions

View File

@ -61,6 +61,13 @@
;;; Method wrapping
(def static-fns {:render
(fn []
(this-as c
(if-not *non-reactive*
(batch/run-reactively c #(do-render c))
(do-render c))))})
(defn custom-wrapper [key f]
(case key
:getDefaultProps
@ -154,11 +161,7 @@
(defn add-render [fun-map render-f]
(assoc fun-map
:cljsRender render-f
:render (if-not *non-reactive*
(fn []
(this-as c
(batch/run-reactively c #(do-render c))))
(fn [] (this-as c (do-render c))))))
:render (:render static-fns)))
(defn wrap-funs [fun-map]
(let [render-fun (or (:componentFunction fun-map)