This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-29
Channels
- # announcements (35)
- # aws (40)
- # babashka (10)
- # beginners (119)
- # calva (25)
- # cider (13)
- # clj-kondo (15)
- # cljsrn (23)
- # clojure (205)
- # clojure-dev (3)
- # clojure-europe (15)
- # clojure-germany (3)
- # clojure-italy (3)
- # clojure-nl (2)
- # clojure-uk (58)
- # clojurescript (193)
- # community-development (2)
- # conjure (147)
- # core-async (49)
- # cursive (47)
- # datomic (27)
- # duct (1)
- # fulcro (19)
- # graalvm (3)
- # graphql (1)
- # helix (3)
- # hoplon (11)
- # jackdaw (1)
- # joker (1)
- # juxt (5)
- # kaocha (1)
- # keechma (3)
- # lambdaisland (6)
- # local-first-clojure (27)
- # malli (5)
- # off-topic (41)
- # rdf (27)
- # re-frame (7)
- # reagent (15)
- # reitit (5)
- # rum (11)
- # shadow-cljs (157)
- # spacemacs (18)
- # sql (4)
- # xtdb (8)
Is there a way to easily add the :key
metadata to form-3 components. I need to completely recreate a form-3 component which I can do by…
[:div ^{:key changing-thing} [form-3-component changing-thing]]
…but I’d prefer it if it were encapsulated within the component. Or is there another way of doing this that I’m not thinking about?ok, that makes sense, I know it’s react that is recreating the component from scratch when the key changes… is there another way of achieving a complete component recreation?
(defn wrapper [changing-thing]
^{:key changing-thing} [form-3-component changing-thing])
you can have the key be part of the usage of the component, use the wrapper method, or refactor the component so that it doesn't rely on component instantiation when props change
it would be interesting if components could unmount themselves, but it's not possible with react today AFAIK
Yeah, I think you’re right… things work well with the component as is so I reckon I’ll just use the wrapper. Thanks!
How do you test reagent view functions. I tried looking online didnt find any good resources
I test it visually with devcards https://github.com/bhauman/devcards
Also online articles that can inspire you https://juxt.pro/blog/posts/cljs-apps.html https://medium.com/adstage-engineering/how-we-test-our-full-stack-clojure-app-b18d79ee9e00
@UBK8J929J just tried devcards. And I have to say I am very impressed!
Cljs podcast episode about Reagent is out! https://soundcloud.com/user-959992602/s4-e2-reagent-with-juho-teperi (this was recorded half a year ago so it doesn't go into detail of the latest changes, but Hooks are mentioned)