mirror of https://github.com/status-im/reagent.git
Reuse render function between components
This commit is contained in:
parent
e4617bcaf6
commit
7d79637de6
|
@ -61,6 +61,13 @@
|
||||||
|
|
||||||
;;; Method wrapping
|
;;; 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]
|
(defn custom-wrapper [key f]
|
||||||
(case key
|
(case key
|
||||||
:getDefaultProps
|
:getDefaultProps
|
||||||
|
@ -154,11 +161,7 @@
|
||||||
(defn add-render [fun-map render-f]
|
(defn add-render [fun-map render-f]
|
||||||
(assoc fun-map
|
(assoc fun-map
|
||||||
:cljsRender render-f
|
:cljsRender render-f
|
||||||
:render (if-not *non-reactive*
|
:render (:render static-fns)))
|
||||||
(fn []
|
|
||||||
(this-as c
|
|
||||||
(batch/run-reactively c #(do-render c))))
|
|
||||||
(fn [] (this-as c (do-render c))))))
|
|
||||||
|
|
||||||
(defn wrap-funs [fun-map]
|
(defn wrap-funs [fun-map]
|
||||||
(let [render-fun (or (:componentFunction fun-map)
|
(let [render-fun (or (:componentFunction fun-map)
|
||||||
|
|
Loading…
Reference in New Issue