Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

FWIW, here is the same example in clojurescript qlkit. It doesn't use "reactive atoms", just the usual state map approach. Of course qlkit's selling point (like for Om) is when global state needs to be synchronized to components, which isn't an issue in this example.

  (ns qlkit-example.core
    (:require [qlkit.core :as ql]))
  
  (defcomponent Counter
    (state {:count 0})
    (render [atts {:keys [count] :as state}]
            [:div [:p "You have clicked the button" count " times."]
                  [:button {:on-click #(ql/update-state! update :count inc)} "Increment"]]))
  
  (ql/mount {:component Counter
             :dom-element (js/document.getElementById "app")})


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: