This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-03
Channels
- # babashka (12)
- # beginners (15)
- # biff (2)
- # calva (17)
- # clj-kondo (19)
- # clj-on-windows (3)
- # clj-otel (1)
- # clojure (3)
- # clojure-europe (5)
- # conjure (2)
- # graalvm (2)
- # helix (5)
- # introduce-yourself (1)
- # nbb (24)
- # off-topic (32)
- # polylith (3)
- # reitit (21)
- # releases (1)
- # reveal (3)
- # scittle (1)
- # squint (56)
- # tools-deps (4)
- # xtdb (6)
I noticed that helix.hooks
contains an implementation of use-subscribe
. React 18 comes with a native hook for this: useSyncExternalStore
, and for older versions there is a shim:
https://reactjs.org/docs/hooks-reference.html#usesyncexternalstore
https://www.npmjs.com/package/use-sync-external-store
I am wondering if we should just use this for use-subscribe
— less code to maintain, plus it will work with React 18?
Moreover, while evaluating Reagent alternatives, I also had a look at uix, which also comes with its own hooks wrappers, that are pretty similar to helix’s. I am wondering if we should join forces and create a separate library just for ClojureScript react hooks?
I am willing to contribute a use-watch
hook that uses use-subscribe
(or useSyncExternalStore
) for refs/atoms (`IWatchable` + IDeref
). This would make it super easy to run a simple state management solution based on just atoms!
…then again Helix provides :auto-deps
which might be less portable. 🤷