This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-19
Channels
- # announcements (10)
- # aws (3)
- # aws-lambda (1)
- # babashka (24)
- # beginners (57)
- # boot (5)
- # calva (20)
- # chlorine-clover (3)
- # cider (14)
- # clj-kondo (37)
- # clojars (17)
- # clojure (200)
- # clojure-dev (40)
- # clojure-europe (9)
- # clojure-france (7)
- # clojure-gamedev (5)
- # clojure-hungary (4)
- # clojure-italy (8)
- # clojure-losangeles (2)
- # clojure-nl (9)
- # clojure-uk (97)
- # clojurebridge (1)
- # clojured (3)
- # clojuredesign-podcast (23)
- # clojurescript (13)
- # code-reviews (2)
- # component (22)
- # core-typed (7)
- # cursive (64)
- # datascript (12)
- # datomic (60)
- # emacs (6)
- # fulcro (54)
- # graalvm (11)
- # graphql (3)
- # hoplon (25)
- # jobs (1)
- # joker (85)
- # juxt (5)
- # kaocha (10)
- # klipse (8)
- # malli (2)
- # off-topic (36)
- # parinfer (1)
- # pathom (1)
- # re-frame (9)
- # reagent (4)
- # reitit (1)
- # remote-jobs (1)
- # shadow-cljs (24)
- # spacemacs (1)
- # sql (39)
- # tools-deps (10)
- # tree-sitter (18)
- # xtdb (18)
Hi! So, I'm trying to add a class that depends on a predicate (`(kid :class (cell= {:active state}))`) but, no matter what I do, the markup ends up <a class="{:active true}" href="/">Home</a>
.
Answering my own question: after digging through the code, it seems that I have to either require hoplon.jquery
or hoplon.goog
so that the multimethod can be loaded.
@rlander glad you found it, you're not the first to run into this
i added a note to https://github.com/hoplon/hoplon/wiki/HTML-Attributes-and-JS-Events#default-on-methods, feel free to edit anywhere on the wiki you would have expected to find it
@alandipert thanks for the link! I totally missed that page. I guess it wouldn't hurt to add a link here: https://github.com/hoplon/hoplon/wiki/Cookbook, under Attribute Inheritance.
please do, thanks
btw, I'm experimenting with Hoplon + shadow-cljs and I'm really enjoying the experience.
great! i have yet to use shadow myself
Assuming I have an element called article-preview
, why does this work:
(for-tpl [article global-feed]
(div (cell= (article-preview article)))))
But this doesn't:
(for-tpl [article global-feed]
(cell= (article-preview article)))))
Also, why do I have to deref within article-preview
when I try this:
(for-tpl [article global-feed]
(article-preview article)))))
....
(defn article-preview [article]
(h2 (:title @article))
I want to help with the documentation, but I guess I need a firmer grasp of how deref'ing cells work.
@rlander these are excellent observations, in the first case you mention i would say for-tpl
stands for "for template" and the body of the for-tpl must evaluate to a non-cell, concrete piece of markup
internally for-tpl is instantiating as many instances of the template it needs to have one for each element of global-feed
at any time
so as global-feed grows and shrinks it recycles existing ones if it can
i think it might be possible for you to conditionalize the "top-level" of the template by using if-tpl
but i haven't used hoplon myself in awhile and i forget
for your 2nd question, for-tpl doesn't auto-deref i don't think. the binding name is a cell. so it will only auto-deref if you refer to it in a cell=
i.e. article
as received by article-preview
is a Cell