ivi-render-to-string
v0.1.0
Published
ivi: Render Virtual DOM to string.
Downloads
3
Maintainers
Readme
ivi-render-to-string [UNIVERSAL]
Render Virtual DOM to string.
This module is working in all environments: browser, server, etc.
API
renderToString(node: VNode<any>, context = ROOT_CONTEXT, owner?: Component<any>): string;
Example
import { $h, $t } from "ivi";
import { renderToString } from "ivi-render-to-string";
renderToString($h("div", "abc").children("Hello World"));
// => <div class="abc">Hello World</div>
renderToString($h("div", "abc").children([$t("Hello"), $t("World")]));
// => <div class="abc"><!---->Hello<!----><!---->World<!----></div>
Adjacent Text Nodes
Adjacent text nodes are separated with HTML Comment nodes.