Public API
Public API
(add-transform-fn f)
(as-element x)
Compiles Hiccup into React elements at run-time.
Compiles Hiccup into React elements at run-time.
(as-react f)
Interop with React components. Takes UIx component function and returns same component wrapped into interop layer.
Interop with React components. Takes UIx component function and returns same component wrapped into interop layer.
(callback f)
(callback f deps)
Takes function f and optional vector of dependencies, and returns f.
Takes function f and optional vector of dependencies, and returns f.
(context v)
Takes React context and returns its current value
Takes React context and returns its current value
(context-provider [ctx value] & children)
Takes a binding form where ctx
is React context and value
is a supplied value
and any number of and child components.
cljs: Injects provided value into the context for current components sub-tree.
clj: Creates new bindings for ctx
with supplied value
, see clojure.core/binding
Takes a binding form where `ctx` is React context and `value` is a supplied value and any number of and child components. cljs: Injects provided value into the context for current components sub-tree. clj: Creates new bindings for `ctx` with supplied `value`, see clojure.core/binding
(create-class {:keys [constructor static prototype]})
Creates class based React component
Creates class based React component
(create-context v)
(create-error-boundary {:keys [display-name error->state handle-catch]
:or {display-name (str (gensym "error-boundary"))}}
render-fn)
Creates React's Error Boundary component
display-name — the name of the component to be displayed in stack trace error->state — maps error object to component's state that is used in render-fn handle-catch — for side-effects, logging etc. render-fn — takes state value returned from error->state and a vector of arguments passed into error boundary
Creates React's Error Boundary component display-name — the name of the component to be displayed in stack trace error->state — maps error object to component's state that is used in render-fn handle-catch — for side-effects, logging etc. render-fn — takes state value returned from error->state and a vector of arguments passed into error boundary
(create-ref)
(create-ref v)
Creates React's ref type object.
Creates React's ref type object.
(cursor-in ref path)
Takes ref type value and path vector and returns ref type cursor value watching into original ref
Takes ref type value and path vector and returns ref type cursor value watching into original ref
(defcontext name)
(defcontext name value)
cljs: Creates React context with initial value set to value
.
clj: Create dynamic var bound to value
.
cljs: Creates React context with initial value set to `value`. clj: Create dynamic var bound to `value`.
(defui sym args & body)
Compiles UIx component into React component at compile-time.
Compiles UIx component into React component at compile-time.
(effect! setup-fn)
(effect! setup-fn deps)
Takes a function to be executed in an effect and optional vector of dependencies.
See: https://reactjs.org/docs/hooks-reference.html#useeffect
Takes a function to be executed in an effect and optional vector of dependencies. See: https://reactjs.org/docs/hooks-reference.html#useeffect
(html expr)
Compiles Hiccup into React elements at compile-time.
Compiles Hiccup into React elements at compile-time.
(layout-effect! setup-fn)
(layout-effect! setup-fn deps)
Takes a function to be executed in a layout effect and optional vector of dependencies.
See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect
Takes a function to be executed in a layout effect and optional vector of dependencies. See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect
(memo f)
(memo f deps)
Takes function f and optional vector of dependencies, and returns memoized f.
Takes function f and optional vector of dependencies, and returns memoized f.
(memoize f)
(memoize f should-update?)
Takes component f
and comparator function should-update?
that takes previous and next props of the component.
Returns memoized f
.
When should-update?
is not provided uses default comparator
that compares props with clojure.core/=
UIx components are memoized by default
Takes component `f` and comparator function `should-update?` that takes previous and next props of the component. Returns memoized `f`. When `should-update?` is not provided uses default comparator that compares props with clojure.core/= UIx components are memoized by default
(no-memoize! f)
Disables memoization of the f
component
Disables memoization of the `f` component
(profiler child {:keys [id on-render] :as attrs})
(ref)
(ref value)
Takes optional initial value and returns React's ref hook wrapped in atom-like type.
Takes optional initial value and returns React's ref hook wrapped in atom-like type.
(state value)
Takes initial value and returns React's state hook wrapped in atom-like type.
Takes initial value and returns React's state hook wrapped in atom-like type.
(strict-mode child)
(subscribe {:keys [get-current-value subscribe] :as subscription})
subscribe - fn, takes callback, sets up a listener on external event emitter which calls the callback and returns a function that unsets the listener.
get-current-value - fn, returns current state of the external event emitter
subscribe - fn, takes callback, sets up a listener on external event emitter which calls the callback and returns a function that unsets the listener. get-current-value - fn, returns current state of the external event emitter
(with-effect deps & body)
Convenience macro for effect hook.
Convenience macro for effect hook.
(with-layout-effect deps & body)
Convenience macro for layout effect hook.
Convenience macro for layout effect hook.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close