mirror of https://github.com/status-im/reagent.git
Update create-class doc strings
This commit is contained in:
parent
91b134aabb
commit
b4789ed0f5
|
@ -103,8 +103,7 @@
|
||||||
(batch/flush-after-render))
|
(batch/flush-after-render))
|
||||||
|
|
||||||
(defn create-class
|
(defn create-class
|
||||||
"Create a component, React style. Should be called with a map,
|
"Creates JS class based on provided Clojure map, for example:
|
||||||
looking like this:
|
|
||||||
|
|
||||||
```cljs
|
```cljs
|
||||||
{:get-initial-state (fn [this])
|
{:get-initial-state (fn [this])
|
||||||
|
@ -118,7 +117,13 @@
|
||||||
:reagent-render (fn [args....])} ;; or :render (fn [this])
|
:reagent-render (fn [args....])} ;; or :render (fn [this])
|
||||||
```
|
```
|
||||||
|
|
||||||
Everything is optional, except either :reagent-render or :render."
|
Everything is optional, except either :reagent-render or :render.
|
||||||
|
|
||||||
|
Map keys should use `React.Component` method names (https://reactjs.org/docs/react-component.html),
|
||||||
|
and can be provided in snake-case or camelCase.
|
||||||
|
Constructor function is defined using key `:get-initial-state`.
|
||||||
|
|
||||||
|
React built-in static methods or properties are automatically defined as statics."
|
||||||
[spec]
|
[spec]
|
||||||
(comp/create-class spec))
|
(comp/create-class spec))
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,9 @@
|
||||||
[c]
|
[c]
|
||||||
(let [f (.-reagentRender c)
|
(let [f (.-reagentRender c)
|
||||||
_ (assert-callable f)
|
_ (assert-callable f)
|
||||||
|
;; cljsLegacyRender tells if this calls was defined
|
||||||
|
;; using :render instead of :reagent-render
|
||||||
|
;; in that case, the :render fn is called with just `this` as argument.
|
||||||
res (if (true? (.-cljsLegacyRender c))
|
res (if (true? (.-cljsLegacyRender c))
|
||||||
(.call f c c)
|
(.call f c c)
|
||||||
(let [v (get-argv c)
|
(let [v (get-argv c)
|
||||||
|
@ -284,7 +287,8 @@
|
||||||
(defn create-class
|
(defn create-class
|
||||||
"Creates JS class based on provided Clojure map.
|
"Creates JS class based on provided Clojure map.
|
||||||
|
|
||||||
Map keys should use `React.Component` method names (https://reactjs.org/docs/react-component.html).
|
Map keys should use `React.Component` method names (https://reactjs.org/docs/react-component.html),
|
||||||
|
and can be provided in snake-case or camelCase.
|
||||||
Constructor function is defined using key `:getInitialState`.
|
Constructor function is defined using key `:getInitialState`.
|
||||||
|
|
||||||
React built-in static methods or properties are automatically defined as statics."
|
React built-in static methods or properties are automatically defined as statics."
|
||||||
|
|
Loading…
Reference in New Issue