Add some docs for adapt-react-class

This commit is contained in:
Dan Holmsand 2015-02-02 17:47:01 +01:00
parent 15acc0d6ff
commit 600d6bbb59
2 changed files with 8 additions and 3 deletions

View File

@ -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

View File

@ -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)