mirror of
https://github.com/status-im/reagent.git
synced 2025-01-29 21:25:56 +00:00
Make core/react a function
That allows us to make react loading lazy in the future.
This commit is contained in:
parent
2f6f2a4491
commit
91a8587b79
@ -13,7 +13,8 @@
|
||||
|
||||
(def is-client util/is-client)
|
||||
|
||||
(def react util/react)
|
||||
(defn react []
|
||||
util/react)
|
||||
|
||||
(defn create-element
|
||||
"Create a native React element, by calling React.createElement directly.
|
||||
@ -33,13 +34,13 @@ which is equivalent to
|
||||
(create-element type nil))
|
||||
([type props]
|
||||
(assert (not (map? props)))
|
||||
($ react createElement type props))
|
||||
($ (react) createElement type props))
|
||||
([type props child]
|
||||
(assert (not (map? props)))
|
||||
($ react createElement type props child))
|
||||
($ (react) createElement type props child))
|
||||
([type props child & children]
|
||||
(assert (not (map? props)))
|
||||
(apply ($ react :createElement) type props child children)))
|
||||
(apply ($ (react) :createElement) type props child children)))
|
||||
|
||||
(defn as-element
|
||||
"Turns a vector of Hiccup syntax into a React element. Returns form unchanged if it is not a vector."
|
||||
|
Loading…
x
Reference in New Issue
Block a user