From 8d35b1f29e866e11d2abd28fe5bdc79d3596cde7 Mon Sep 17 00:00:00 2001 From: Dan Holmsand Date: Thu, 14 Jul 2016 08:39:43 +0200 Subject: [PATCH] Avoid warnings about unknown props in new React --- examples/todomvc/src/todomvc/core.cljs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/todomvc/src/todomvc/core.cljs b/examples/todomvc/src/todomvc/core.cljs index 83a3db9..93ed17d 100644 --- a/examples/todomvc/src/todomvc/core.cljs +++ b/examples/todomvc/src/todomvc/core.cljs @@ -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 - :on-change #(reset! val (-> % .-target .-value)) - :on-key-down #(case (.-which %) - 13 (save) - 27 (stop) - nil)})]))) + (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)}]))) (def todo-edit (with-meta todo-input {:component-did-mount #(.focus (r/dom-node %))}))