uix.core.alpha

Public API

add-transform-fn

Injects attributes transforming function for Hiccup elements pre-transformations

as-element

(as-element x)

as-react

(as-react f)

callback

React’s callback hook. Takes callback and deps.

create-ref

(create-ref)(create-ref v)

Creates React’s ref type object.

default-compare-args

(default-compare-args a b)

defui

macro

(defui sym args & body)

Compiles UIx component into React component at compile-time.

effect!

React’s effect hook. Takes callback and deps.

html

macro

(html expr)

Compiles Hiccup into React elements at compile-time.

layout-effect!

React’s layout effect hook. Takes callback and deps.

memo

React’s memo hook. Takes callback and deps.

memoize

(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/=

ref

Returns React’s ref hook wrapped in atom-like type. Takes optional initial value.

require-lazy

macro

(require-lazy form)

require-like macro, returns lazy-loaded React components.

(require-lazy ’[my.ns.components :refer [c1 c2]])

state

Returns React’s state hook wrapped in atom-like type.

strict-mode

(strict-mode child)

use-let

macro

(use-let bindings & body)

Bind variables as with let, except that the bindings are only evaluated once.

with-effect

macro

(with-effect deps & body)

Convenience macro for effect hook.

with-layout-effect

macro

(with-layout-effect deps & body)

Convenience macro for layout effect hook.