This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-05
Channels
- # adventofcode (89)
- # announcements (9)
- # babashka (11)
- # beginners (8)
- # biff (5)
- # calva (4)
- # cherry (121)
- # clara (15)
- # clerk (16)
- # clj-kondo (20)
- # clj-otel (2)
- # cljdoc (20)
- # clojure (84)
- # clojure-austin (1)
- # clojure-bay-area (3)
- # clojure-berlin (1)
- # clojure-czech (2)
- # clojure-europe (59)
- # clojure-nl (1)
- # clojure-norway (12)
- # clojure-poland (1)
- # clojure-uk (15)
- # cursive (16)
- # datomic (46)
- # events (3)
- # fulcro (85)
- # graalvm (20)
- # hyperfiddle (11)
- # improve-getting-started (1)
- # lsp (7)
- # off-topic (48)
- # overtone (8)
- # podcasts-discuss (4)
- # re-frame (31)
- # releases (1)
- # ring (12)
- # sci (13)
- # shadow-cljs (8)
- # specter (3)
- # squint (26)
- # xtdb (5)
- # yamlscript (6)
I updated to squint 0.4.72 and it looks like conditional rendering is broken
(defn App []
(let [picked-emoji true]
#jsx [View {}
(if picked-emoji
#jsx [Text "Picker"]
#jsx [Text "Not picked"])]))
Compiling to
var App = (function () {
let picked_emoji1 = true;
return
});
(squint_core.truth_(picked_emoji1)) ? (
lost {} around (
I wonder if there is interest in a construct in #C03U8L2NXNC which lets you "compile" literal HTML, like so:
It is compiled straight to a templated string so it just works ™️ and you can render it into the dom with innerHTML and friends
would be kind of nice to not have to do :onclick "bar()"
and instead be able to do :onclick bar
-- and have bar
receive the event
object when it's triggered
another idea to configure the tag, e.g. for lit/html:
(defn my-tag [& args]
args)
(def x 1)
#html ^my-tag [:div "Hello" x] ;;=> [ [ '<div>Hello', '</div>' ], 1 ]
I actually hadn't really handled receiving events and such in inline event handlers https://stackoverflow.com/a/16404397
I knew there was a way
but it seems messy
yeah, the other answers aren't great either
<p onclick="doSomething(a,b,event,c,d)">
it scans for "event" and passes it in that position 😬
so yeah, anything we can do to make this not gross would be amazing
Probably just writing addEventListener
manually would be the least surprising. The #html
isn't any magic, just hiccup rendering basically
another idea to configure the tag, e.g. for lit/html:
(defn my-tag [& args]
args)
(def x 1)
#html ^my-tag [:div "Hello" x] ;;=> [ [ '<div>Hello', '</div>' ], 1 ]
and we could have normal #str ^lit/html ["" x ""]
to make template string more generalized