API Reference

Namespaces

uix.core package

  • uix.core — primary namespace, contains the core functionality of the library
  • uix.preload — preload that enables hot-reloading
  • uix.re-frame — re-frame integration

uix.dom package

  • uix.dom — re-exports core functions from react-dom and react-dom/client
  • uix.dom.server — cljs, re-exports core functions from react-dom/server
  • uix.dom.server — clj, implements JVM renderer

Commonly used functions

uix.core

  • defui — creates a new component
  • $ — creates an element
  • defhook — creates a custom hook
  • use-state — local state hook
  • use-effect — runs after every update
  • use-ref — creates a mutable ref
  • use-memo — memoizes a computation
  • use-callback — caches a callback
  • create-context — creates React context
  • use-context — accesses React context value

uix.dom

  • create-root — creates React root from DOM element
  • render-root — renders UIx element into React root
  • hydrate-root — hydrates server rendered HTML with a given UIx element
  • create-portal — creates a React portal into DOM node outside of React tree

More rarely used functions

uix.core

  • fn — creates anonymous component
  • create-class — creates class-based component
  • create-error-boundary — creates an error boundary
  • use-layout-effect — runs after every update, but before the content is painted on the screen
  • suspense — displays a fallback until its children have finished loading
  • as-react — makes UIx component usable in JavaScript/React
  • lazy — creates a loadable UIx component
  • clone-element — clones and returns a new UIx element