Created
February 26, 2015 10:27
-
-
Save zuzkins/691341cfd79c9179cf80 to your computer and use it in GitHub Desktop.
Om vs om-tools macro
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
(defn om-component [data owner] | |
(om-tools/component | |
(init-state [_} {:counter 1}) | |
(render-state [_ state] (dom/div nil (str "Hello " (:name data) ": " (:counter state)))) | |
(will-unmount [_] (.log js/console "bye")))) | |
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
(defcomponent om-component [data owner] | |
(init-state [_} {:counter 1}) | |
(render-state [_ state] (dom/div nil (str "Hello " (:name data) ": " (:counter state)))) | |
(will-unmount [_] (.log js/console "bye"))) | |
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
(defn om-component [data owner] | |
(reify | |
om/IInitState | |
(init-state [_} {:counter 1}) | |
om/IRenderState | |
(render-state [_ state] (dom/div nil (str "Hello " (:name data) ": " (:counter state)))) | |
om/IWillUnmount | |
(will-unmount [_] (.log js/console "bye")))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment