This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-17
Channels
- # aws (2)
- # beginners (34)
- # boot (39)
- # cider (28)
- # cljs-dev (2)
- # cljsrn (30)
- # clojure (195)
- # clojure-austin (6)
- # clojure-dev (6)
- # clojure-dusseldorf (1)
- # clojure-france (1)
- # clojure-russia (139)
- # clojure-spec (25)
- # clojure-uk (66)
- # clojurescript (125)
- # community-development (1)
- # core-async (42)
- # cryogen (1)
- # cursive (22)
- # datascript (6)
- # datomic (67)
- # docker (1)
- # emacs (7)
- # events (1)
- # garden (3)
- # hoplon (15)
- # jobs (3)
- # lein-figwheel (10)
- # leiningen (3)
- # luminus (4)
- # mount (2)
- # nginx (1)
- # off-topic (101)
- # om (42)
- # om-next (6)
- # onyx (7)
- # proton (1)
- # protorepl (4)
- # re-frame (15)
- # reagent (30)
- # remote-jobs (1)
- # ring (8)
- # ring-swagger (17)
- # rum (1)
- # spacemacs (2)
- # sql (1)
- # yada (50)
@brthrjon You can put them wherever you want. We tend to group our handlers, events, subs and views in a namespace based on functionality. Our event stuff goes into an events.cljs within each namespace, so that’s where we put reg-fx's
@brthrjon Be aware you need to load any namespaces that have a reg-fx from your entry point / main so that the events get registered.
@stuartrexking Thanks for that!
(aget js/object "prop1" "prop2" "prop3") ;; JS output: object["prop1"]["prop2"]["prop3"];
it doesn't look like aset has anything analagous... anybody got a nifty way to do that?
I think assoc-in is what you want.
@stuartrexking couldn't get that to work, tried to use property names as strings but didn't work... eventually settled on (set! (-> obj .-field1 .-field2) value)
Ok. I don’t know about the js syntax for doing that, but if it was a clojure map I would do assoc-in
@curlyfry thanks for the pointers 🙂
@minikomi @stuartrexking I was actually disappointed that assoc-in doesn't work. That's what it does, sets a value in a nested structure given the path of keys. However, what I'm doing is mutating, which makes assoc-in inappropriate. Thanks for both of you for your input.