-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,3 +41,4 @@ playground/public/public/src/squint | |
!playground/viteconfig.mjs | ||
out | ||
.env | ||
App.jsx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
(ns App | ||
#_:clj-kondo/ignore | ||
(:require ["react" :as React]) | ||
(:require ["react-dom" :as rdom]) | ||
(:require ["jotai" :as jotai :refer [useAtom]])) | ||
|
||
(def !anime (jotai/atom | ||
[{:title "Ghost in the Shell" | ||
:year 1995 | ||
:watched true} | ||
{:title "Serial Experiments Lain" | ||
:year 1998 | ||
:watched false}])) | ||
|
||
(defn App [] | ||
(let [[anime setAnime] (useAtom !anime)] | ||
#jsx [:div | ||
[:ul | ||
(for [item anime] | ||
#jsx [:li {:key (:title item)} | ||
(:title item)])] | ||
[:button {:onClick #(setAnime (conj anime | ||
{:title "Cowboy Bebop" | ||
:year 1998 | ||
:watched false}))} | ||
"Add Cowboy Bebop"]])) | ||
|
||
(defonce elt (js/document.querySelector "#app")) | ||
|
||
(rdom/render #jsx [App] elt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Jotai example | ||
|
||
[Jotai](https://jotai.org/) is a primitive and flexible state management for React. | ||
|
||
To run this example, run `npm install` and then `npm run dev`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<html> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="./App.jsx"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"dependencies": { | ||
"jotai": "^2.10.1", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2" | ||
}, | ||
"devDependencies": { | ||
"concurrently": "^9.0.1", | ||
"squint-cljs": "^0.8.117", | ||
"vite": "^5.4.9" | ||
}, | ||
"scripts": { | ||
"vite:dev": "vite", | ||
"squint:watch": "squint watch", | ||
"dev": "concurrently \"npm run vite:dev\" \"npm run squint:watch\"" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{:paths ["."]} |