News for hackers. Stuff that matters.
Re:Thinking in React Hooks by drcode on Thursday December 12, 2019 @11:54AM (#21773565)
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")})

There are no comments on this comment yet.