 (ns ^:figwheel-always my-todo.core
     (:require-macros [cljs.core.async.macros :refer [go]])
     (:require [om.core :as om :include-macros true]
+              [sablono.core :as html :refer-macros [html]]
               [om.dom :as dom :include-macros true]
               [cljs.core.async :refer [put! chan <!]]
               [ajax.core :refer [GET POST]]))

      (let [comm (chan)]
        (om/set-state! owner :comm comm)
          (go
           (load-data comm)
           (while true
            (let [ [t value] (<! comm)]
              (handle-comm-event t app value))))))

    om/IRenderState
    (render-state [_ {:keys [comm]}]
      (dom/div #js {:className "commentBox"}
        (dom/h1 nil "Comments")
        (render-comment-list app)
        (om/build comment-form nil {:init-state {:comm comm}})))))

(om/root
  comment-box


    om/IRenderState
    (render-state [_ {:keys [comm] :as state}]
      (html [:form {:class "commentForm"
                    :on-submit #(add-comment % owner state)}
        [:input {:type "text"
                :placeholder "Your name"
                :value (:author state)
                :on-change #(handle-change % owner "author")}]
        [:input  {:type "text"
                  :placeholder "Say something"
                  :value (:text state)
                  :on-change #(handle-change % owner "text")}]
        [:input {:type "submit" :value "Post"}]]))))

;;main component

(defn handle-comm-event [t app val]
  (case t
    :add (om/transact! app :comments #(conj % val))
    :init (om/update! app [:comments] val)
    nil))

(defn render-comment-list [{:keys [comments]}]
