uix
:page/ignore? true :page/body
This file is a merged representation of a subset of the codebase, containing specifically included files, combined into a single document. The content has been processed where security check has been disabled. Generated by Repomix on: 2025-02-11T11:27:16.294Z
Files
File: docs/chat-gpt.md
# Getting help from ChatGPT
You can use ChatGPT to translate React/JavaScript code into UIx/ClojureScript using the following prompt:
```
You are language to language translator. Your job is to translate code from JS, React, JSX to Clojure. In Clojure we use UIx library which adds DSL on top of React to create components and elements. The library provides uix.core namespace which includes top level api, as well as react hooks.
Components are created using defui macro, here’s the syntax: (defui component-name [props-map] body)
Elements are created using $ macro: ($ :dom-element optional-props-map …children)
Component names and props are written in kebab-case. Dom element keywords support hyper script syntax to define classes and id: :div#id.class
JS names should be translated into idiomatic Clojure names, for example is-visible should become visible?
Translate the following code to Clojure
```
The prompt works quite well, here's an example:
```js
// input
function Item({ name, isPacked }) {
return <li className="item">{name}</li>;
}
export default function PackingList() {
return (
<section>
<h1>Sally Ride's Packing List</h1>
<ul>
<Item isPacked={true} name="Space suit" />
<Item isPacked={true} name="Helmet with a golden leaf" />
<Item isPacked={false} name="Photo of Tam" />
</ul>
</section>
);
}
```
```clojure
;; output
(ns packing-list.core
(:require [uix.core :refer [$ defui]]))
(defui item [{:keys [name packed?]}]
($ :li.item name))
(defui packing-list []
($ :section
($ :h1 "Sally Ride's Packing List")
($ :ul
($ item {:packed? true :name "Space suit"})
($ item {:packed? true :name "Helmet with a golden leaf"})
($ item {:packed? false :name "Photo of Tam"}))))
```File: docs/code-linting.md
File: docs/code-splitting.md
File: docs/components.md
File: docs/differences-from-reagent.md
File: docs/effects.md
File: docs/elements.md
File: docs/hooks.md
File: docs/hot-reloading.md
File: docs/internals.md
File: docs/interop-with-react.md
File: docs/interop-with-reagent.md
File: docs/migrating-from-reagent.md
File: docs/props-validation.md
File: docs/react-devtools.md
File: docs/react-native.md
File: docs/react-three-fiber.md
File: docs/server-side-rendering.md
File: docs/state.md
File: docs/utilities.md
File: docs/what-is-uix.md
Last updated