A Pen by Michael SALIHI on CodePen.
Created
June 2, 2023 15:31
-
-
Save hatemhosny/99653ca3e82e4d1a87dcb240dffe2370 to your computer and use it in GitHub Desktop.
ClojureScript Reagent (Scittle)
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
<div id="app"></div> | |
<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> |
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
<script src="https://cdn.jsdelivr.net/npm/scittle@0.1.2/dist/scittle.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/17.0.2/umd/react.production.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/17.0.2/umd/react-dom.production.min.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/scittle@0.1.2/dist/scittle.reagent.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment