npm.io
0.1.0 • Published 9 years ago

ivi-render-to-string

Licence
MIT
Version
0.1.0
Deps
0
Vulns
0
Weekly
0
Stars
795

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.

Keywords