Skip to content

Instantly share code, notes, and snippets.

@bsteuber
Created March 3, 2015 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsteuber/3ebab902294a05c01d01 to your computer and use it in GitHub Desktop.
Save bsteuber/3ebab902294a05c01d01 to your computer and use it in GitHub Desktop.
;; 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