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))
|
||||
|
||||
(defn create-class
|
||||
"Create a component, React style. Should be called with a map,
|
||||
looking like this:
|
||||
"Creates JS class based on provided Clojure map, for example:
|
||||
|
||||
```cljs
|
||||
{:get-initial-state (fn [this])
|
||||
|
@ -118,7 +117,13 @@
|
|||
: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]
|
||||
(comp/create-class spec))
|
||||
|
||||
|
|
|
@ -98,6 +98,9 @@
|
|||
[c]
|
||||
(let [f (.-reagentRender c)
|
||||
_ (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))
|
||||
(.call f c c)
|
||||
(let [v (get-argv c)
|
||||
|
@ -284,7 +287,8 @@
|
|||
(defn create-class
|
||||
"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`.
|
||||
|
||||
React built-in static methods or properties are automatically defined as statics."
|
||||
|
|
Loading…
Reference in New Issue