This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Hey @benzen, I think there is an easier way to implement this, give me a minute and I'll show you
I'm just trying to find a minimal example that, i hope, could be a rookie mistake example in the re-frame wiki
I'd propose:
(defn counter []
(let [value (r/atom 3)]
(fn []
[:div "Value: " @value
[:button {:on-click #(swap! value inc)} "+"]
[:button {:on-click #(when (< 0 @value) (swap! value dec))} "-"]])))
But There may be a better way@escherize: updated