This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-24
Channels
- # adventofcode (2)
- # anglican (1)
- # announcements (4)
- # aws (2)
- # babashka (28)
- # beginners (18)
- # brompton (3)
- # calva (22)
- # clj-kondo (2)
- # cljdoc (29)
- # clojure (41)
- # clojure-europe (28)
- # clojure-gamedev (14)
- # clojure-nl (2)
- # clojure-spec (2)
- # clojure-sweden (1)
- # clojure-uk (6)
- # clojurescript (53)
- # css (3)
- # cursive (6)
- # duct (3)
- # emacs (5)
- # fulcro (29)
- # introduce-yourself (1)
- # liberator (5)
- # lsp (1)
- # malli (11)
- # meander (4)
- # nbb (11)
- # off-topic (17)
- # pathom (2)
- # polylith (8)
- # practicalli (1)
- # react (6)
- # reagent (11)
- # releases (2)
- # rewrite-clj (11)
- # shadow-cljs (59)
- # tools-deps (21)
- # vim (11)
this is a great discussion for library authors: https://github.com/reactwg/react-18/discussions/84
seems v relevant for people maintaining or building libraries for managing state external from React
currently you can look up an instance of a component on the page (called a fiber) and get things like props, state, and children
(require '[react-repl.core :as rr])
(rr/find my-component)
;; => #object[FiberNode]
(-> (rr/find my-component)
(rr/state))
;; => ({:type "useState", :current {:name "foo"}, :dispatch #object[dispatch]} {:type "useCallback" :current #js [object[Function] #js []]})
(-> (rr/find my-component)
(rr/props))
;; => {:initial-name "foo"}
(-> (rr/find my-component)
(rr/state)
(first)
(rr/hook-dispatch {:name "bar"}))
;; => {:name "bar"}
(-> (rr/find my-component)
(rr/state))
;; => ({:type "useState", :current {:name "bar"}, :dispatch #object[dispatch]} {:type "useCallback" :current #js [object[Function] #js []]})
❤️ 11