Server-side rendering

UIx supports SSR in JavaScript and JVM.

SSR in JavaScript

JavaScript based server-side rendering is using existing JavaScript package for serializing React’s Virtual DOM into HTML string.

Add react-dom/server package into your project via http://cljsjs.github.io/ or any other way and compile it with :target :nodejs compiler setting.

(uix.dom/render-to-string [:h1 "Hello!"])

SSR on JVM

When executing on JVM UIx serializes Hiccup directly into HTML string. The code stays the same, but in order to target multiple execution environments the code should be written in cljc files.

(uix.dom/render-to-string [:h1 "Hello!"])

Last updated