(clicks button-text)

Shows the number of times the user clicked the button.

Example

[clicks "Click me!"]

Source

(defn clicks "Shows the number of times the user clicked the button." [button-text] (let [state (r/atom {:clicks 0})] (fn [] [:div [:p "You clicked " (:clicks @state) " times"] [:button {:on-click (fn [] (swap! state update :clicks inc))} button-text]])))