File tree Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -97,10 +97,10 @@ options.errorBoundaries = true;
97
97
98
98
---
99
99
100
- ### ` Suspense ` & ` lazy ` components with [ ` preact/compat ` ] ( https://www.npmjs.com/package/preact ) & [ ` preact-ssr-prepass ` ] ( https://www.npmjs.com/package/preact-ssr-prepass )
100
+ ### ` Suspense ` & ` lazy ` components with [ ` preact/compat ` ] ( https://www.npmjs.com/package/preact )
101
101
102
102
``` bash
103
- npm install preact preact-render-to-string preact-ssr-prepass
103
+ npm install preact preact-render-to-string
104
104
```
105
105
106
106
``` jsx
@@ -125,19 +125,12 @@ const Main = () => {
125
125
```
126
126
127
127
``` jsx
128
- import { render } from ' preact-render-to-string' ;
129
- import prepass from ' preact-ssr-prepass' ;
128
+ import { renderToStringAsync } from ' preact-render-to-string' ;
130
129
import { Main } from ' ./main' ;
131
130
132
131
const main = async () => {
133
- // Creation of the virtual DOM
134
- const vdom = < Main / > ;
135
-
136
- // Pre-rendering of lazy components
137
- await prepass (vdom);
138
-
139
- // Rendering of components
140
- const html = render (vdom);
132
+ // Rendering of lazy components
133
+ const html = await renderToStringAsync (< Main / > );
141
134
142
135
console .log (html);
143
136
// <h1>Home page</h1>
You can’t perform that action at this time.
0 commit comments