Avoid warnings about unknown props in new React

This commit is contained in:
Dan Holmsand 2016-07-14 08:39:43 +02:00
parent 42ba1662cb
commit 8d35b1f29e
1 changed files with 9 additions and 8 deletions

View File

@ -31,14 +31,15 @@
save #(let [v (-> @val str clojure.string/trim)] save #(let [v (-> @val str clojure.string/trim)]
(if-not (empty? v) (on-save v)) (if-not (empty? v) (on-save v))
(stop))] (stop))]
(fn [props] (fn [{:keys [id class placeholder]}]
[:input (merge props [:input {:type "text" :value @val
{:type "text" :value @val :on-blur save :id id :class class :placeholder placeholder
:on-blur save
:on-change #(reset! val (-> % .-target .-value)) :on-change #(reset! val (-> % .-target .-value))
:on-key-down #(case (.-which %) :on-key-down #(case (.-which %)
13 (save) 13 (save)
27 (stop) 27 (stop)
nil)})]))) nil)}])))
(def todo-edit (with-meta todo-input (def todo-edit (with-meta todo-input
{:component-did-mount #(.focus (r/dom-node %))})) {:component-did-mount #(.focus (r/dom-node %))}))