Introducing renderAsHTML()
When you need to render a Cycle app from the server and serve it as HTML, you use renderAsHTML(vtree$)
which takes a vtree$
and outputs an Observable of HTML strings, namely html$
. Then just subscribe to html$
to get the html
string and send it as a response.
See the documentation for renderAsHTML()
.
See a complete isomorphic (server-side rendering and client-side rendering) example.
See the tests for more examples, including also custom elements rendered as HTML.