devcards

Devcards aims to provide a visual REPL experience for ClojureScript https://github.com/bhauman/devcards
maio 2016-02-07T16:22:40.000024Z

My card doesn't re-render when state changes. Any idea why? (I can see state changes in inspector)

(defcard-rg counter
  (fn [data _]
    [:div
     [:h2 "Counter Example"]
     [:div (:counter @data)]
     [:button {:on-click (fn [e] (swap! data update :counter inc))} "+"]])
  (reagent/atom {:counter 0})
  {:inspect-data true})

maio 2016-02-07T16:42:12.000025Z

hmm this works

(defn xxx [data]
  [:div (@data :counter)])

(defcard-rg counter
  (fn [data _]
    [:div
     [:h2 "Counter Example"]
     [xxx data]
     [:button {:on-click (fn [e] (swap! data update :counter inc))} "+"]])
  (reagent/atom {:counter 0})
  {:inspect-data true
   :history true})