Fork me on GitHub
#rum
<
2023-03-02
>
Mark Wardle11:03:44

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..?

Mark Wardle12:03:17

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?

Mark Wardle12:03:52

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?

Mark Wardle16:03:43

That’s really helpful. Thank you!

serioga16:03:50

It's my own solution, dunno how “right” is it. You can ask for details if something is not clear. Good luck!

Mark Wardle16:03:31

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.