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)]
(if-not (empty? v) (on-save v))
(stop))]
(fn [props]
[:input (merge props
{:type "text" :value @val :on-blur save
(fn [{:keys [id class placeholder]}]
[:input {:type "text" :value @val
:id id :class class :placeholder placeholder
:on-blur save
:on-change #(reset! val (-> % .-target .-value))
:on-key-down #(case (.-which %)
13 (save)
27 (stop)
nil)})])))
nil)}])))
(def todo-edit (with-meta todo-input
{:component-did-mount #(.focus (r/dom-node %))}))