Skip to content

Instantly share code, notes, and snippets.

@borkdude
Last active October 27, 2023 12:28
Show Gist options
  • Save borkdude/e83da19df3d2739861334171779f79d5 to your computer and use it in GitHub Desktop.
Save borkdude/e83da19df3d2739861334171779f79d5 to your computer and use it in GitHub Desktop.
hoplon demo
(ns view.index
(:require
[hoplon.core :as h]
[javelin.core :as j]))
(defn my-list [& items]
(h/div :class "my-list"
(apply h/ul (map #(h/li (h/div :class "my-list-item" %)) items))))
(defonce clicks (j/cell 0))
(def clicks-times-3 (j/cell= (* 3 clicks)))
(defn hello []
(h/div
(h/h1 "Hello, Hoplon")
(my-list
(h/span "first thing")
(h/span "second thing"))
(h/p (h/text "You've clicked ~{clicks} times, so far. (times 3 = ~{clicks-times-3})"))
(h/button :click #(swap! clicks inc) "click me")))
(.replaceChildren (.getElementById js/document "app")
(hello))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment