The simplest way to start a new project with UIx is to use create-uix-app CLI:
npx create-uix-app@latest my-app # bare-bones project
npx create-uix-app@latest my-app --re-frame # adds re-frame setup
npx create-uix-app@latest my-app --fly-io # creates full stack app with Fly.io
npx create-uix-app@latest MyApp --react-native # setup cljs project in existing React Native project
npx create-uix-app@latest MyApp --expo # create a new React Native project using Expo
Or just drop these files into your project
{:deps {thheller/shadow-cljs {:mvn/version "3.2.1"}
com.pitch/uix.core {:mvn/version "1.4.7"}
com.pitch/uix.dom {:mvn/version "1.4.7"}}}
{:deps true
:builds
{:app {:target :browser
:modules {:main {:entries [app.core]
:init-fn app.core/start}}
:output-dir "out"
:asset-path "/out"
:devtools {:preloads [uix.preload]}}}}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
</head>
<body>
<div id="root"></div>
<script src="/out/main.js"></script>
</body>
</html>
(ns app.core
(:require [uix.core :as uix :refer [defui $]]
[uix.dom]))
(defui button [{:keys [on-click children]}]
($ :button.btn {:on-click on-click} children))
(defui app []
(let [[state set-state!] (uix/use-state 0)]
($ :<>
($ button {:on-click #(set-state! dec)} "-")
($ :span state)
($ button {:on-click #(set-state! inc)} "+"))))
(defonce root (uix.dom/create-root (js/document.getElementById "root")))
(defn start []
(uix.dom/render-root ($ app) root))
npm i -D react@19.2.0 react-dom@19.2.0 react-refresh process
clojure -M -m shadow.cljs.devtools.cli watch app
clojure -M -m shadow.cljs.devtools.cli release app