Skip to content

Instantly share code, notes, and snippets.

@nooga

nooga/test.cljs

Last active Sep 28, 2015
Embed
What would you like to do?
(defonce state (atom {:items [{:name "apple" :tasty true}
{:name "shoe" :tasty false}
{:name "glue" :tasty true}]}))
(defn toggle-tasty [name]
;... swap! :items
)
(defn item [i]
[:div [:span (:name i)]
[:input {:type "checkbox" :checked (:tasty i) :on-change (fn [x] (toggle-tasty (:name i)))}]
(defn items [its]
[:div
(for [i its]
[item i])])
(reagent/render-component [items (:items @state)]
(. js/document (getElementById "app")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment