0.1.0 • Published 7 years ago

ivi-render-to-string v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

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.