Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (ns om-tutorial.part
- (:require
- goog.debug.formatter
- goog.debug.RelativeTimeProvider
- [goog.dom :as gdom]
- [om.next :as om :refer-macros [defui]]
- [om.dom :as dom]))
- (def app-state (atom {:count 0}))
- (defui Counter
- Object
- (render [this]
- (let [{:keys [count]} (om/props this)]
- (dom/div nil
- (dom/span nil (str "Count: " count))
- (dom/br nil nil)
- (dom/button
- #js {:onClick
- (fn [e]
- (swap! app-state update-in [:count] inc))}
- "Click me!")))))
- (def reconciler
- (om/reconciler {:state app-state}))
- (om/add-root! reconciler
- Counter js/klipse-container)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement