ivi-render-to-string
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

ivi-render-to-string [UNIVERSAL]

Render Virtual DOM to string.

This module is working in all environments: browser, server, etc.

API

renderToString(nodeVNode<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.

Package Sidebar

Install

npm i ivi-render-to-string

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • localvoid