This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-24
Channels
- # announcements (2)
- # beginners (22)
- # cider (10)
- # clojure (47)
- # clojure-italy (2)
- # clojure-spec (2)
- # clojure-uk (1)
- # clojurebridge (5)
- # clojurescript (19)
- # cursive (1)
- # data-science (7)
- # datomic (2)
- # duct (18)
- # emacs (6)
- # figwheel-main (2)
- # java (2)
- # luminus (1)
- # nrepl (20)
- # off-topic (69)
- # om (3)
- # pathom (45)
- # quil (2)
- # re-frame (16)
- # reagent (1)
- # reitit (6)
- # ring (2)
- # shadow-cljs (33)
- # tools-deps (9)
- # vim (6)
- # yada (1)
@r.natarajan35 you should probably just start with Reagent and forget re-frame for a while. But ultimately re-frame (or something like it) will become necessary (depending on the complexity of the apps you develop) https://github.com/Day8/re-frame/blob/master/docs/FAQs/DoINeedReFrame.md
@witek for me, it would be a code smell to see multiple dispatches in a single button's on-click
But, yes, technically, you can do it
It is code smell because I believe an event should model "user intent".
When a user clicks a button they want one thing to happen.
So there's one event dispatched
Where people often get this wrong is when they imagine dispatching events to be like "calling a function"
So the user clicks the button and they want to "call multiple functions" to implement the user's goal
So they want to dispatch multuple times
I believe this is the wrong way to think about things
The button should cause one event to be emitted
The event handler for that event is what can call multiple functions to get the job done.
So: 1. The event models the user's intent. 2. The associated event handler implements that intent
BTW, sometimes events also model triggers from OTHER external actors, like "arriving websocket message" or HTTP GET response. But mainly they are modelling the user (as an external actor and initiator of triggers)
To put this yet another way ... your events collectively implement "the language" that your application understands. They implement the set of things to which your application can respond. Events do not model implementation (function calls).
</end>