Functions for using reacl-c within a React application or library.
Functions for using reacl-c within a React application or library.
(embed item & [options])
Returns a React element embedding the given item. Current :state
and
state changes (:set-state!
) are controlled by the corrensponding options.
Toplevel actions and effects are passed to the optional
:handle-action!
function. To have effects being executed
implicitly, use reacl-c.main/execute-effects
. Messages can be
sent to the item via send-message!
.
Returns a React element embedding the given item. Current `:state` and state changes (`:set-state!`) are controlled by the corrensponding options. Toplevel actions and effects are passed to the optional `:handle-action!` function. To have effects being executed implicitly, use [[reacl-c.main/execute-effects]]. Messages can be sent to the item via [[send-message!]].
(send-message! ref msg)
Sends a message to an embedded item via a ref to it.
Sends a message to an embedded item via a ref to it.
(with-embed f)
Returns an item, that calls f
with a function like embed
, which
takes items and embeds them with the state of the returned
item. Also, actions emitted by the embedded items are emitted
from the returned item. A second argument to f
is a function to
embed React-C event handlers as a React event handler.
This can be handy for adding items as children for lifted React container classes:
(defn my-container [on-clik & items]
(with-embed
(fn [embed-item embed-event-handler]
(apply reacl-c.interop.react/lift MyReactContainer #js {:onClick (embed-event-handler on-click}
(map embed-item items))
Returns an item, that calls `f` with a function like [[embed]], which takes items and embeds them with the state of the returned item. Also, actions emitted by the embedded items are emitted from the returned item. A second argument to `f` is a function to embed React-C event handlers as a React event handler. This can be handy for adding items as children for lifted React container classes: ```clojure (defn my-container [on-clik & items] (with-embed (fn [embed-item embed-event-handler] (apply reacl-c.interop.react/lift MyReactContainer #js {:onClick (embed-event-handler on-click} (map embed-item items)) ```
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 |