Skip to main content
Module

x/pagic/mod.ts

A static site generator powered by Deno + React
Latest
import * as pagic from "https://deno.land/x/pagic@v1.6.3/mod.ts";

Functions

Render a React element to its initial HTML. Returns a Readable stream that outputs an HTML string. The HTML output by this stream is exactly equal to what ReactDOMServer.renderToString() would return.

Only available in the environments with Node.js Streams.

Only available in the environments with Web Streams (this includes browsers, Deno, and some modern edge runtimes).

Similar to renderToString, except this doesn't create extra DOM attributes such as data-reactid, that React uses internally. This is useful if you want to use React as a simple static page generator, as stripping away the extra attributes can save lots of bytes.

Similar to renderToNodeStream, except this doesn't create extra DOM attributes such as data-reactid, that React uses internally. The HTML output by this stream is exactly equal to what ReactDOMServer.renderToStaticMarkup() would return.

Render a React element to its initial HTML. This should only be used on the server. React will return an HTML string. You can use this method to generate HTML on the server and send the markup down on the initial request for faster page loads and to allow search engines to crawl your pages for SEO purposes.