This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-02
Channels
- # announcements (25)
- # babashka (76)
- # beginners (74)
- # biff (36)
- # calva (11)
- # cider (5)
- # clerk (43)
- # cljs-dev (4)
- # cljsrn (12)
- # clojure (111)
- # clojure-austin (14)
- # clojure-europe (82)
- # clojure-nl (2)
- # clojure-norway (5)
- # clojure-uk (1)
- # clojurescript (36)
- # core-async (13)
- # cursive (30)
- # datomic (12)
- # fulcro (6)
- # honeysql (9)
- # hyperfiddle (73)
- # instaparse (3)
- # introduce-yourself (1)
- # membrane (40)
- # nbb (2)
- # off-topic (6)
- # other-languages (9)
- # polylith (33)
- # reagent (2)
- # reitit (7)
- # rum (7)
- # shadow-cljs (47)
- # tools-deps (10)
- # vim (11)
- # xtdb (16)
Hi all. I am sorry for the stupid question here, but I'd like to do partial hydration client-side. I'm generating server side HTML using Rum. I can see how I'd use shadowclj to compile some cljs and make it available on demand from a script tag on an arbitrary page. So where does one run the hydrate and if you are doing this for a few components on a page, how does one handle the ids etc..?
In the examples, I can see that the examples are hydrated in one go on page load at defined ids. For production use, would I generate a server-side rendered <script> tag that would call hydrate on the component at a dynamically generated id, for example?
Or better to render the page server side, and then on page mount at the top level hydrate using the same components client-side, even though most of the page is not reactive?
I mount like: • https://github.com/serioga/webapp-clojure-2020/blob/master/src/app/rum/mount.cljc • https://github.com/serioga/webapp-clojure-2020/blob/master/src/app/%24_example/main.cljs • https://github.com/serioga/webapp-clojure-2020/blob/master/src/app/%24_example/handler/example_react.clj
That’s really helpful. Thank you!
It's my own solution, dunno how “right” is it. You can ask for details if something is not clear. Good luck!
The use of transit is interesting and I’ll need to delve deeper! The complexity makes me wonder whether I should just use a bit of bespoke JavaScript to turn on or off stuff like I used it with JQuery in the olden days.