I have done a server render of an app. How to init server side rendered app after render happened? e.g.:
require("@riotjs/ssr/register")();
const App = require("./app.riot").default;
const riotRender = require("@riotjs/ssr").default;
app.get('/app', function (req, res) {
res.render('../apps/apps/t/base', {
app: "some data"
});
});
And the server side just has riot compiler connected. I did not get from the docs on how it should be done. Init a Riot component does not seem to help me. E.g. UI.
<!doctype html>
<html lang="en">
<head>
<script src="/js/riot+compiler.min.js"></script>
</head>
<app>[Rendered HTML]</app>
Adding component and initialising it like with browser rendering did not help.
One needs to "@hydrate" the component. Use the lib alongside with @ssr rendering lib in riot. There is a good example about it. https://github.com/riot/examples/tree/gh-pages/ssr
Somehow docs on Server side rendering do not mention it broadly. Hope it helps someone else.