 (ns todomvc-reagent.core
   (:require [reagent.core :as r]
             [clojure.string :as s]))
+
+;; -------------------------
+;; Constants
+
+(def KEY_ENTER 13)
+(def KEY_ESCAPE 27)
 
 ;; -------------------------
 ;; Db

        :placeholder placeholder
        :on-blur save
        :on-change #(reset! val (-> % .-target .-value))
        :on-key-down #(case (.-which %)
                        13 (save)
                        27 (stop)
                        nil)}])))

(defn todo-item []
  (let [editing (r/atom false)]

           active-cnt (- (count items) completed-cnt)]
      [:div
       [:section.todoapp
        [todo-header "reagent" "What needs to be done?"]

        (when (pos? (count items))
          [:div
