Created
November 6, 2025 12:41
-
-
Save sogaiu/1d4c32c4f70fe17773a64319b1fde28c to your computer and use it in GitHub Desktop.
scittle reagent (from https://babashka.org/scittle/)
This file contains hidden or 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
| <html> | |
| <head> | |
| <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/scittle.js" type="application/javascript"></script> | |
| <script crossorigin src="https://cdn.jsdelivr.net/npm/react@18/umd/react.production.min.js"></script> | |
| <script crossorigin src="https://cdn.jsdelivr.net/npm/react-dom@18/umd/react-dom.production.min.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/scittle.reagent.js" type="application/javascript"></script> | |
| <script type="application/x-scittle"> | |
| (require '[reagent.core :as r] | |
| '[reagent.dom :as rdom]) | |
| (def state (r/atom {:clicks 0})) | |
| (defn my-component [] | |
| [:div | |
| [:p "Clicks: " (:clicks @state)] | |
| [:p [:button {:on-click #(swap! state update :clicks inc)} | |
| "Click me!"]]]) | |
| (rdom/render [my-component] (.getElementById js/document "app")) | |
| </script> | |
| </head> | |
| <body> | |
| <div id="app"></div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment