Fork me on GitHub
#reagent
<
2017-03-18
>
shdzzl00:03:01

@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.

gordon00:03:52

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.

shdzzl00:03:38

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)))}])

gordon00:03:43

that combination did the trick for me, too. you're absolutely right.

gordon00:03:03

anyway this issue has been haunting me as well, so thanks