You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/docs/src/server/docs/02-components.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -123,7 +123,7 @@ function Component() {
123
123
124
124
## Running components
125
125
126
-
To evaluate components (for example, if you aren't using `App` or need to call them separately), you can use the `toGenerator` and `toString` functions.
126
+
To evaluate components (for example, if you aren't using `App` or need to call them separately), you can use these functions.
127
127
128
128
### toGenerator
129
129
@@ -141,6 +141,22 @@ for await (const chunk of gen) {
141
141
}
142
142
```
143
143
144
+
### toStream
145
+
146
+
Turn a `JSX.Element` into a `ReadableStream<Uint8Array>`, this pipes the result of `toGenerator` into a `ReadableStream`.
147
+
148
+
```tsx
149
+
import { toStream } from"ovr";
150
+
151
+
const Component = () => <p>element</p>;
152
+
153
+
const stream =toStream(Component);
154
+
155
+
const response =newResponse(stream, {
156
+
"Content-Type": "text/html; charset=utf-8",
157
+
});
158
+
```
159
+
144
160
### toString
145
161
146
162
Convert any `JSX.Element` into a `string` of HTML with `toString`. This runs `toGenerator` joins the results into a single string.
0 commit comments