Skip to content

realize ssr_

jiyinyiyong edited this page Mar 21, 2020 · 2 revisions

realize-ssr!

This one is complicated. I wrote a long post before trying to explain this new feature. The code looks like this:

(def ssr? (some? (.querySelector js/document "meta.respo-ssr")))
(def mount-target (.querySelector js/document ".app"))

(if ssr?
  (realize-ssr! mount-target
    (comp-container @store-ref ssr-stages)
    dispatch!))

The job of realize-ssr! function is to simulate a virtual DOM of currently rendered HTML from server, so that the followed virtual DOM rendering steps can run a little easier.