Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
;; 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
You can’t perform that action at this time.