Fork me on GitHub
#reagent
<
2015-09-06
>
escherize10:09:49

Hey @benzen, I think there is an easier way to implement this, give me a minute and I'll show you

benzen10:09:06

Oh no that's ok

escherize10:09:17

Oh, alright. simple_smile

benzen10:09:48

I'm just trying to find a minimal example that, i hope, could be a rookie mistake example in the re-frame wiki

escherize10:09:33

I see. So imho, your working component could be clearer

escherize10:09:28

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

benzen11:09:11

mhh i like that thanks