This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-01-27
Channels
- # announcements (24)
- # babashka (26)
- # beginners (8)
- # calva (8)
- # clojure (78)
- # clojure-europe (1)
- # clojure-norway (22)
- # clojurescript (14)
- # datascript (5)
- # datomic (8)
- # fulcro (22)
- # helix (9)
- # humbleui (11)
- # malli (4)
- # off-topic (28)
- # pedestal (5)
- # reitit (10)
- # shadow-cljs (2)
- # tools-build (8)
- # tools-deps (9)
Why isn't com.fulcrologic.fulcro.application/app-root set in the runtime atom when mounted?
What I'm trying to get at is the root-- React18 wants you to use createRoot to make the root and then call render on that on subsequent updates, so I need a handle on the root. I currently just put it in a separate atom, e.g., I override :render-root!
with:
(fn [a, r]
(let [root (or @*root (reset! *root (createRoot r)))]
(.render root a)))
I’m not aware it wasn’t. The app itself has an internal place where it stores app root. You can mount 400 apps on one page (like the Fulcro book, for example, which does just that), so a single top-level atom is not where you’d want it. (application/app-root an-app)
is how you are intended to get it.
Each app has a runtime-atom
that is meant to hold all manner of things like this, including whatever else you’d like to put there (as nsed kws, of course).
That function returns nil for me when called on the app produced by com.fulcrologic.rad.application/fulcro-rad-app
Anything compelling about 18? I’m happy to drop down to 17 if it isn’t important.
I've never needed the app root outside of initial render... Which is internal, so not surprised if it broke and no one noticed
Yeah- only reason I noticed was I wanted to stop the react warning about using the deprecated render function.
With react 18, you call createRoot and then call render on the result.
If you already have a root, then you just call render.
e.g., I override :render-root!
with:
(fn [a, r]
(let [root (or @*root (reset! *root (createRoot r)))]
(.render root a)))
I want to ask the app for the root, instead. is there a react 18 specific render-root! function I missed?
where is it? I missed it
ah, got it. I’ll look for it, thanks (also not at a computer ;) )
Merge (com.fulcrologic.fulcro.react.version18/react18-options)
into the app config. See e.g. https://github.com/holyjak/minimalist-fulcro-template-backendless/blob/main/src/com/example/app.cljs#L15-L29