This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-22
Channels
- # ai (1)
- # announcements (1)
- # babashka (9)
- # beginners (18)
- # calva (19)
- # clerk (136)
- # clj-http (3)
- # clj-kondo (13)
- # cljs-dev (166)
- # clojure (39)
- # clojure-europe (133)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-uk (12)
- # clr (1)
- # community-development (6)
- # conjure (8)
- # cursive (13)
- # data-science (1)
- # datomic (26)
- # events (5)
- # fulcro (12)
- # gratitude (3)
- # honeysql (9)
- # hyperfiddle (33)
- # introduce-yourself (6)
- # kaocha (1)
- # lambdaisland (5)
- # malli (4)
- # off-topic (3)
- # rdf (4)
- # re-frame (3)
- # releases (3)
- # scittle (11)
- # specter (2)
- # sql (4)
- # tools-deps (4)
- # vim (10)
Someone recently asked about best practice and it occurred to me that I don't have a summary anywhere covering any of the "more recent" developments. So I threw this entry together. What else should it contain?' https://github.com/day8/re-frame/blob/master/docs/FAQs/BestPractice.md
Shameless plug for https://github.com/zalky/reflet a library I wrote 🙃. But I do genuinely think it takes Re-frame to the next level with all the modern bells and whistles, plus some nice unique features, while staying true to all the things that makes Re-frame so excellent.
I often find people wanting to use a subscription inside of an event handler, which isn’t possible desirable. There are two “workarounds” I think of, in order of preference:
1. if an event is dispatched by something in a component, then have the component subscribe to the sub, and pass the value of the subscription into the event vector
2. extract the computation into a dedicated function of the app-db and use it in both the sub and event handler, so you no longer need to rely on the sub
I like (1) because it feels a lot more in line with the “re-frame way” of modelling an application, but it has its drawbacks, as it assumes whoever is dispatching the event exists in a reactive context, and (2) doesn’t feel very nice because the event handler will never be able to make use of cached values.