Last active
September 28, 2015 15:43
-
-
Save nooga/2da3bff215f0f7d2adb3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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