Skip to content

server rendering

jiyinyiyong edited this page Mar 21, 2020 · 4 revisions

Server rendering

Virtual DOM can be rendered on a server. Most of the Respo code is in .cljc files so it can be rendered with JVM. But usually I use it with shadow-cljs in ClojureScript. Here's a template to run ClojureScript in Node.js.

Find out in the section: SSR.

make-string is the function to render HTML. realize-ssr! is also useful to make first screen look smoother, make sure it's called before render!.

Notice that when rendering on server, events are not bound, internally we use mute-element to remove events before rendering. Without realize-ssr!, render! function will remove existing DOM and mount the whole tree.

Clone this wiki locally