Scala, React, and SSR (part 1)

Hi everyone,

For people who use React from Scala, how to have SSR has long been a mystery. I’ve finally gotten around to writing up an article to how do it, and how it works.


1 Like

Wouldn’t it be easier to just cross-compile the relevant parts of scalajs-react and reimplement whatever react SSR does? Isn’t it just walking through the vdom tree and generating html server side minus event handlers?

Cool idea but nah. It’d be one thing to do that for React’s renderToStaticString but renderToString produces other attributes that don’t affect the UI, that are there specially for hydration in the frontend. It’s internal React logic and I don’t know what that logic is. It’d be too much to try to copy it as you’d want to add tests cases that cover everything, and then you’d need to always be on top of whatever changes they make to their internals.