This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-09
Channels
- # admin-announcements (5)
- # architecture (8)
- # beginners (7)
- # boot (41)
- # braveandtrue (1)
- # cider (77)
- # clara (3)
- # cljs-dev (56)
- # cljsjs (7)
- # cljsrn (7)
- # clojure (44)
- # clojure-austin (3)
- # clojure-brasil (1)
- # clojure-hk (3)
- # clojure-russia (137)
- # clojure-spec (14)
- # clojure-uk (44)
- # clojurescript (33)
- # cloverage (3)
- # core-async (10)
- # css (1)
- # cursive (16)
- # datomic (116)
- # devcards (14)
- # emacs (1)
- # events (1)
- # funcool (2)
- # functionalprogramming (1)
- # hammock-driven-dev (1)
- # jobs-rus (124)
- # lein-figwheel (1)
- # leiningen (1)
- # liberator (4)
- # melbourne (3)
- # mount (73)
- # off-topic (3)
- # om (4)
- # om-next (15)
- # onyx (38)
- # other-languages (4)
- # perun (2)
- # proton (36)
- # protorepl (2)
- # random (1)
- # re-frame (56)
- # reagent (7)
- # specter (4)
- # testing (1)
- # untangled (13)
- # yada (18)
(defmulti mutate om/dispatch)
(defmethod mutate 'increment
[{:keys [state] :as env} key {:keys [new] :as params}]
{:action #(swap! state assoc :count new)})
...
(dom/input #js {:type "text"
:onKeyUp #(om/transact! this `[(increment {:new ~(.. % -target -value)})])})
I have the following message:
core.cljs:9608 Uncaught Error: No method in multimethod 'om-tuto.core/mutate' for dispatch value: om-tuto.core/increment
does anyone knows what is missing?
I've spent the whole afternoon 😞
@vinnyataide: do this: #(om/transact! this [(list 'increment {:new (.. % -target -value)})])
or also could work (not sure) #(om/transact! this `[('increment {:new ~(.. % -target -value)})])
@hlolli tried to change the list format but the message changed to call of undefined :x
now it worked
I've made a typo, forgot to take out the tilde
I'd rather take that warning seriously, since the first one is probably a namespace error (the backtic one)
yeah I gotta learn how to escape properly
is there any way to write the expression more concise? seems very verbose to me
well, I use the list often, got used to it. You could use keyword or anything that is accepted as dispatch for multimethod. But the problem with backtic is that it dereferences the current namespace, kinda shit(when it is unwanted). And the positive side with symbols are that they are visually seperated from keywords in read multimethods. I see reasons for and against using symbols for dispatch, but if that's the cultural usage om, then its better to get used to this habit.
@hlolli: great insight