This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-18
Channels
- # beginners (22)
- # boot (12)
- # cider (3)
- # cljs-dev (12)
- # cljsrn (8)
- # clojure (101)
- # clojure-nl (5)
- # clojure-russia (13)
- # clojure-spec (5)
- # clojure-uk (15)
- # clojurescript (158)
- # cursive (5)
- # datascript (16)
- # datomic (8)
- # hoplon (11)
- # lumo (33)
- # off-topic (3)
- # om (25)
- # parinfer (1)
- # pedestal (8)
- # protorepl (4)
- # re-frame (8)
- # reagent (5)
- # specter (18)
- # sql (1)
- # testing (11)
- # timbre (1)
- # unrepl (2)
- # untangled (1)
@kenny Using on-input works for me, why isn't it considered a valid handler? If you're worried about browser compatibility, there's a table here: https://developer.mozilla.org/en/docs/Web/API/GlobalEventHandlers/oninput Can't look into this anymore right now, but I'll come back to it. The workaround @gws provided is reasonable.
strange that React prefers onChange to onInput, context in this thread (complaints at the bottom): https://github.com/facebook/react/issues/3964 - I can't find any reference to it in the docs, though.
This is my code. I'm using a reagent sandbox project I have, so maybe I should make a new one. Testing in chrome. Not receiving a warning, and it's behaving as a number input without any js at all.
(defonce input-state (r/atom 0))
(defn hello []
[:input {:type "number"
:value @input-state
:on-input (fn [evt]
(let [val (.. evt -target -value)]
(reset! input-state val)))}])