Last active
November 17, 2023 11:08
-
-
Save mynomoto/27e65a9d3c6fc24d59e554d55d84aee3 to your computer and use it in GitHub Desktop.
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
(ns view.index | |
(:require | |
[hoplon.core :as h] | |
[javelin.core :as j])) | |
(j/defc i 0) | |
(j/defc j 1) | |
(j/defc k 2) | |
(def formula-of-test (j/formula-of [i j k] (+ i j k))) | |
(defn formula-of-example | |
[] | |
(h/div | |
(h/h2 "formula-of") | |
(h/div (h/text "i: ~{i} j: ~{j} k: ~{k}")) | |
; we should be able to see the result after `=` | |
(h/div (h/text "~{i} + ~{j} + ~{k} = ~{formula-of-test}")) | |
(h/button :click #(swap! i inc) "i++") | |
(h/button :click #(swap! i dec) "i--") | |
(h/button :click #(swap! j inc) "j++") | |
(h/button :click #(swap! j dec) "j--") | |
(h/button :click #(swap! k inc) "k++") | |
(h/button :click #(swap! k dec) "k--"))) | |
(.replaceChildren (.getElementById js/document "app") | |
(formula-of-example)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment