This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-08
Channels
- # 100-days-of-code (1)
- # admin-announcements (1)
- # aleph (1)
- # announcements (9)
- # beginners (125)
- # cider (1)
- # cljs-dev (80)
- # cljsrn (2)
- # clojure (82)
- # clojure-czech (1)
- # clojure-dev (5)
- # clojure-finland (1)
- # clojure-italy (16)
- # clojure-nl (6)
- # clojure-spec (24)
- # clojure-uk (39)
- # clojurescript (35)
- # community-development (49)
- # core-async (3)
- # cursive (31)
- # data-science (17)
- # datomic (21)
- # emacs (5)
- # fulcro (92)
- # graphql (1)
- # jobs (2)
- # lambdaisland (1)
- # leiningen (19)
- # luminus (9)
- # off-topic (21)
- # parinfer (6)
- # pedestal (1)
- # portkey (2)
- # re-frame (12)
- # reagent (8)
- # reitit (4)
- # shadow-cljs (117)
- # spacemacs (5)
- # specter (4)
- # sql (2)
- # testing (2)
- # tools-deps (3)
- # vim (1)
Hi all, this threading macro has saved my life a couple times, yet I have no idea what it's doing: (-> % .-target .-value)
what do the .-target and .-value (presumably) functions do?
@js I am assuming you are using this within say an input
's on-change event. The .-
syntax is a way to access a property on a javascript object. So for the on-change, you can use .-target
to get the thing in the dom that is firing the event (which would be an input), and then you can use .-value
to access the value of that input (i.e., what you just typed in the input)
ah. so it's fetching the value of the event's target, not actually setting anything
I see. I'd not known about .-
well awesome. thanks, I'll be able to sleep tonight, now!