This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-28
Channels
- # aleph (3)
- # beginners (10)
- # boot (135)
- # clara (2)
- # cljsjs (2)
- # cljsrn (1)
- # clojure (68)
- # clojure-austin (4)
- # clojure-france (2)
- # clojure-japan (1)
- # clojure-spec (30)
- # clojure-uk (11)
- # clojurescript (48)
- # component (65)
- # cursive (5)
- # datomic (40)
- # dirac (5)
- # emacs (3)
- # events (16)
- # funcool (2)
- # klipse (46)
- # lein-figwheel (2)
- # luminus (8)
- # off-topic (4)
- # om (7)
- # other-languages (4)
- # parinfer (21)
- # re-frame (15)
- # reagent (30)
- # ring (1)
- # ring-swagger (9)
- # rum (3)
- # specter (7)
- # test-check (8)
- # testing (5)
- # vim (21)
- # yada (4)
Hi guys. I ran into this issue today. http://stackoverflow.com/questions/40304349/how-to-access-reagent-components-children-elements-correctly I'm already tampered by that thing. Glad I found reagent channel. Someone please give me a hint regarding that issue. Thanks
@cl0jurian A bit hard to understand exactly what the issue is. Is a request sent at all or do you get an error or?
@mac Sorry Its not much clear. My problem is the input element's on-change event handler function cannot get the chosen file.
@cl0jurian Try this: (-> % .-target .-files (aget 0))
@mac but an error comes "Uncaught TypeError: Cannot read property 'files' of undefined"
@cl0jurian I think you should avoid this whole this
business and use (-> e .-target .-files (aget 0))
- as far as I can tell there is no reason to use this
or this-as
here.
@cl0jurian You are welcome. I posted it on stackoverflow too. While you are at it, why are you creating an atom (state_) and immediately dereffing it? and why are you let binding the component to ad-box instead of just returning it?
hi guys, I have a basic question. I am confused how to use reagent atom. Let say we a have an atom
(def my-atom (r/atom {:number 0}))
if I want access that atom from my fn I just access it by @my-atom
. for example
(defn component [] [:p (@my-atom :number])
But.. why it doesnt work when I want swap. like
(swap! @my-atom update :number inc)
it does work when I replace @my-atom
to my-atom
.
codxse: the value of swap!
is to operate on the atom directly, atomically, even if someone else tries to do the same concurrently
technically you can put a mutable value in an atom, I think — but that’s awful, bad, don’t do it, none of the guarantees hold, &c
@mac I want to do here is keep track of the preview images of 8 upload boxes. what do you think @mac is it a good approach ?
@cl0jurian Not sure what you mean by "keep track of".
@mac my intension is to update these upload boxes according to user's behavior. user could upload and remove uploaded pic etc. Havent coded that part at the moment. May be its not a good move. Im just new to Reagent/React and also to Luminus. Hope you understood what I trying to do here @mac . But Im not sure my approach isn't good.
@cl0jurian Well an atom could be a good way of controlling what image is shown, I was just confused as to why you would do what you do in the code included in the example.