mirror of https://github.com/status-im/reagent.git
Add some docs for adapt-react-class
This commit is contained in:
parent
15acc0d6ff
commit
600d6bbb59
|
@ -43,7 +43,10 @@ which is equivalent to
|
|||
[form]
|
||||
(tmpl/as-element form))
|
||||
|
||||
(defn adapt-react-class [c]
|
||||
(defn adapt-react-class
|
||||
"Returns an adapter for a native React class, that may be used
|
||||
just like a Reagent component function or class in Hiccup forms."
|
||||
[c]
|
||||
(tmpl/adapt-react-class c))
|
||||
|
||||
(defn render
|
||||
|
|
|
@ -162,8 +162,10 @@
|
|||
(assert (ifn? f) (str "Expected a function, not " (pr-str f)))
|
||||
(warn-unless (not (and (fn? f)
|
||||
(some? (.' f :type))))
|
||||
"Using native React classes directly "
|
||||
"is not supported: " (.' f :type) (comp/comp-name))
|
||||
"Using native React classes directly in Hiccup forms "
|
||||
"is not supported. Use create-element or "
|
||||
"adapt-react-class instead: " (.' f :type)
|
||||
(comp/comp-name))
|
||||
(let [spec (meta f)
|
||||
withrender (assoc spec :component-function f)
|
||||
res (comp/create-class withrender)
|
||||
|
|
Loading…
Reference in New Issue