This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-27
Channels
- # announcements (10)
- # beginners (95)
- # biff (2)
- # calva (33)
- # cherry (1)
- # clj-kondo (16)
- # clojure (96)
- # clojure-australia (1)
- # clojure-china (1)
- # clojure-europe (42)
- # clojure-filipino (1)
- # clojure-france (2)
- # clojure-hk (1)
- # clojure-indonesia (1)
- # clojure-japan (1)
- # clojure-korea (1)
- # clojure-my (1)
- # clojure-nl (1)
- # clojure-norway (24)
- # clojure-sg (11)
- # clojure-taiwan (1)
- # clojure-uk (1)
- # clojurescript (21)
- # cursive (22)
- # data-science (3)
- # events (7)
- # fulcro (3)
- # graalvm (4)
- # gratitude (6)
- # helix (11)
- # honeysql (7)
- # hoplon (1)
- # introduce-yourself (1)
- # jobs (2)
- # jobs-discuss (16)
- # lsp (15)
- # malli (14)
- # nbb (73)
- # practicalli (3)
- # reagent (8)
- # reitit (5)
- # releases (1)
- # ring (5)
- # rum (3)
- # sci (17)
- # scittle (7)
- # shadow-cljs (22)
- # tools-deps (26)
- # xtdb (9)
The examples for hydration with rum involve just rendering an entire react component to document.body
. But I'm having trouble hydrating in just a part of an html page.
Say I want to render a component to a home.html page and then hydrate.
(render-file
"home.html"
{:component-to-render (rum/render-html header)})
Then I include it on the page.
<div id="component-root">
a {{ component-to-render }}
</div>
Unfortunately that will just render a literal string, so I cant hydrate it from there.
I would expect to be able to do this in the clojurescript
(rum/hydrate header (.getElementById js/document "component-root"))
Is there no way to do this kind of partial hydration on a plain html page?I was able to solve this with the safe
filter in selmer.
<div id="component-root">
a {{ component-to-render|safe }}
</div>