Created
March 3, 2015 13:43
-
-
Save bsteuber/3ebab902294a05c01d01 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
;; no assumtion of outer state/events | |
;; more setup work, more flexibility and straightforward testing | |
(defn my-component [model event-channel] | |
[:div.blah | |
(for [blub @model] | |
[:div.blub {:on-click #(>! event-channel [:blub-click (:id blub)])} | |
(:text blub)])]) | |
;; uses global app-state and global event-queue | |
;; less typing, but testing gets harder | |
(defn my-component [] | |
[:div.blah | |
(for [blub @blub-state] | |
[:div.blub {:on-click #(dispatch [:blub-click (:id blub)])} | |
(:text blub)])]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment