From ffa8ea2eafc1d72c5a9a50535c341f27b822ac0d Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Sun, 17 Mar 2024 14:07:33 +0100 Subject: [PATCH] chore: Update readme for suspense rendering --- README.md | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index fb326c34..34617c04 100644 --- a/README.md +++ b/README.md @@ -97,10 +97,10 @@ options.errorBoundaries = true; --- -### `Suspense` & `lazy` components with [`preact/compat`](https://www.npmjs.com/package/preact) & [`preact-ssr-prepass`](https://www.npmjs.com/package/preact-ssr-prepass) +### `Suspense` & `lazy` components with [`preact/compat`](https://www.npmjs.com/package/preact) ```bash -npm install preact preact-render-to-string preact-ssr-prepass +npm install preact preact-render-to-string ``` ```jsx @@ -125,19 +125,12 @@ const Main = () => { ``` ```jsx -import { render } from 'preact-render-to-string'; -import prepass from 'preact-ssr-prepass'; +import { renderToStringAsync } from 'preact-render-to-string'; import { Main } from './main'; const main = async () => { - // Creation of the virtual DOM - const vdom =
; - - // Pre-rendering of lazy components - await prepass(vdom); - - // Rendering of components - const html = render(vdom); + // Rendering of lazy components + const html = await renderToStringAsync(
); console.log(html); //

Home page