                      {:id 2 :status :open :title "Buy Food"}
                      {:id 3 :status :open :title "Implement next Step"}]})
 
+(defn close-item [component id]
+  (om/transact! component `[(tudu.item/close {:id ~id}) :tudu/items]))
+
 (defui TodoItemUI
   static om/IQuery
   (query [this]

  Object
  (render [this]
          (let [{:keys [id status title]} (om/props this)
                class-name (str "todo-list-item-title status-" (name status))]
            (dom/div #js {:className "todo-list-item" :key (str "todo-item-" id)}
                     (dom/span #js {:className class-name} title)))))

(def todo-item-ui (om/factory TodoItemUI {:keyfn :id}))

  (let [st @state]
    (into [] (map #(get-in st %)) (get st :tudu/items))))

(defmethod read :tudu/items [{:keys [state]} key params]
  {:value (get-items state)})

(defmethod mutate 'tudu.item/close [{:keys [state]} _ {:keys [id]}]
  {:action (fn []
             (swap! state
                    #(assoc-in % [:tudu.items/by-id id :status] :close)))})

(defonce reconciler (om/reconciler
                      {:state initial-state
                       :parser (om/parser {:read read :mutate mutate})}))

(om/add-root! reconciler UI (gdom/getElement "main-app-area"))
