JSPM

ivi-render-to-string

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q15889F
  • License MIT

ivi: Render Virtual DOM to string.

Package Exports

  • ivi-render-to-string

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ivi-render-to-string) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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.