This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-06-03
Channels
- # aws (12)
- # beginners (12)
- # biff (10)
- # calva (1)
- # cider (10)
- # cljfx (1)
- # clojure (2)
- # clojure-conj (1)
- # clojure-europe (25)
- # clojure-madison (1)
- # clojure-nl (1)
- # clojure-norway (12)
- # clojure-sweden (4)
- # clojure-uk (6)
- # datomic (11)
- # dev-tooling (3)
- # emacs (5)
- # gratitude (1)
- # introduce-yourself (7)
- # java (3)
- # jobs (1)
- # london-clojurians (2)
- # lsp (23)
- # off-topic (4)
- # practicalli (9)
- # quil (6)
- # re-frame (3)
- # reagent (4)
- # remote-jobs (1)
- # ring (1)
- # shadow-cljs (18)
- # squint (67)
- # tools-deps (5)
- # xtdb (4)
- # yamlscript (12)
Do props count as reactive values for r/reaction
and r/track
?
No, unless the values in those props are themselves reactive. But you can also come up with a situation where it might seem as if they're reactive. Something like:
(def counts (r/atom []))
(defn total-view-impl [total']
[:span "Total: " @total'])
(defn total-view [offset]
(let [total (r/reaction (+ offset (apply + @counts))]
[view-impl total]))
But of course it is only an illusion because that reaction will be re-created anew each time the offset
changes.
It would not be recreated if [view-impl total]
was wrapped in another fn
, and it would not track any changes to offset
.Hmmm so ideally we'd be looking at a form 2 that captures the prop in a reactive store and then uses that in the render fn?