Public API for use with Reagent, Ref. https://github.com/reagent-project/reagent.
Public API for use with Reagent, Ref. https://github.com/reagent-project/reagent.
(-new-cmptfn id
?mount-rvals-fn
?render-rvals-fn
render-fn
?post-render-fn
?unmount-fn)Returns a new Reagent component defined in terms of special cmptfn lifecycle fns. These in turn are defined in a special macro context to get magic bindings and flow-through behaviour, etc.
Returns a new Reagent component defined in terms of special cmptfn lifecycle fns. These in turn are defined in a special macro context to get magic bindings and flow-through behaviour, etc.
(cmptfn id params & args)Reagent component fn util. Provides a sensible let-flow API for writing simple, flexible Clj/s Reagent components.
(cmptfn id ; Component identifier for debugging, error reporting, etc. [x y] ; Reagent args passed to component :let-mount [] ; Est. with each instance mount, avail. downstream :let-render [] ; Est. with each instance render, avail. downstream, pure! :render <body> ; Or just provide render body as final arg, pure! :post-render <body> ; For DOM node setup/mutation :unmount <body> ; For DOM node teardown )
this-cmpt, this-mounting?.[<cmpt> {:ref (fn [node] _)}] or (enc/oget ev "currentTarget").Reagent component fn util. Provides a sensible let-flow API for writing
simple, flexible Clj/s Reagent components.
(cmptfn
id ; Component identifier for debugging, error reporting, etc.
[x y] ; Reagent args passed to component
:let-mount [] ; Est. with each instance mount, avail. downstream
:let-render [] ; Est. with each instance render, avail. downstream, pure!
:render <body> ; Or just provide render body as final arg, pure!
:post-render <body> ; For DOM node setup/mutation
:unmount <body> ; For DOM node teardown
)
- Magic bindings: `this-cmpt`, `this-mounting?`.
- Nodes: `[<cmpt> {:ref (fn [node] _)}]` or `(enc/oget ev "currentTarget")`.
- Call Reagent components as:
* (<cmpt> <...>) - to get inlining.
* [<cmpt> <...>] - to get an intermediary Reagent component:
* Rerender-iff-args-change semantics.
* Can take ^{:key _} [<cmpt> <...>].(def-cmptfn sym & sigs)Defines a top-level Reagent component fn using cmptfn.
See the cmptfn docstring for more details on args, etc.
Defines a top-level Reagent component fn using `cmptfn`. See the `cmptfn` docstring for more details on args, etc.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |