Convert OCaml Vdom Node to html string

98 views Asked by At

I'm trying to use janestreet/virtual_dom both in the browser and on my server. In the browser, you don't use HTML directly, that's the whole point of vdom! But, on the server, I'm interested in trying to figure out how to render an HTML document using the same ocaml code that I use in the browser. I've seen that the vdom testing library has a mechanism to convert a VDOM node to a HTML string, but the element type is not a true VDOM.Node element type! There's also a VDOM to_dom function that converts a VDOM node to JS of Ocaml, but I'm not certain I can get that into an HTML string either. I expected to be able to use innerHTML on the resultant el, but was unable to do so.

Any tips?

0

There are 0 answers