This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-07
Channels
- # announcements (9)
- # beginners (155)
- # bristol-clojurians (1)
- # calva (49)
- # chlorine-clover (36)
- # cider (10)
- # clara (6)
- # clj-kondo (14)
- # clojars (28)
- # clojure (226)
- # clojure-australia (1)
- # clojure-berlin (12)
- # clojure-czech (1)
- # clojure-europe (26)
- # clojure-germany (1)
- # clojure-nl (2)
- # clojure-uk (32)
- # clojurescript (9)
- # conjure (21)
- # datascript (3)
- # datomic (43)
- # emacs (3)
- # figwheel-main (16)
- # fulcro (17)
- # graalvm (9)
- # helix (4)
- # lambdaisland (3)
- # malli (13)
- # off-topic (12)
- # pathom (7)
- # re-frame (10)
- # reitit (9)
- # rewrite-clj (2)
- # shadow-cljs (41)
- # spacemacs (6)
- # specter (3)
- # test-check (5)
- # tools-deps (9)
- # tree-sitter (1)
- # vim (15)
- # xtdb (3)
I have a lot of
(re-frame/reg-event-db ...)
rolling around
Any reason against doing
(def db-events {:event1 handler1
:event2 handler2})
And then (map reg-event-db db-events)
Just for the sake of saving characters π
The issue with such approach is that it would make it harder to selectively change interceptors.
And BTW I don't do it when I have just regular event IDs with corresponding handlers - I just call reg-event-*
as usual in such cases.
But I always do it when I have roughly the same handler for a bunch of events. Then I iterate over event IDs with maybe some parameters that slightly alter how the handler works.
slightly unrelated but a little bit related, check out https://gitlab.com/nikperic/reframe-utils if you haven't, removes a modest amount of boilerplate
I like the idea but donβt use it currently. One possible complication is code reloading. Does the code change trigger re-registering the event? Does re-frame throw a lot of re-register warnings?
All solvable