Skip to content

Instantly share code, notes, and snippets.

@mynomoto
Last active November 17, 2023 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mynomoto/d701f0393c058fb528534e2e076691d0 to your computer and use it in GitHub Desktop.
Save mynomoto/d701f0393c058fb528534e2e076691d0 to your computer and use it in GitHub Desktop.
(ns view.index
(:require
[hoplon.core :as h]
[javelin.core :as j]))
(j/defc cond-tpl-number 4)
(j/defc= is-4 (= cond-tpl-number 4))
(defn cond-tpl-example
[]
(h/div
(h/h2 "cond-tpl")
(h/p (h/text "the number is: ~{cond-tpl-number}"))
; this form should show in the ui but doesn't
(h/cond-tpl is-4 (h/div "totally random!")
(j/cell= (= cond-tpl-number 0)) (h/div "something went wrong...")
(j/cell= (> cond-tpl-number 1)) (h/div "balloons")
:else (h/div "bananas"))
(h/button :click #(reset! cond-tpl-number (rand-int 5))
"Change condition result")))
(.replaceChildren (.getElementById js/document "app")
(cond-tpl-example))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment