Rendering & SSR

renderToStringAsync

Renders a component tree to an HTML string and awaits all async reads in the subtree before resolving. The returned HTML reflects the fully-settled state — no <Loading> fallbacks appear in the output.

Use this when you want a complete page in one round-trip. For incremental streaming with progressive boundary resolution, use renderToStream.


Import

import { renderToStringAsync } from "@solidjs/web";

Type signature

function renderToStringAsync<T>(
fn: () => T,
options?: {
timeoutMs?: number;
nonce?: string;
renderId?: string;
noScripts?: boolean;
plugins?: any[];
manifest?: Record<
string,
{
file: string;
css?: string[];
isEntry?: boolean;
isDynamicEntry?: boolean;
imports?: string[];
}
>;
onError?: (err: any) => void;
}
): Promise<string>;

Examples

import { renderToStringAsync } from "@solidjs/web";
const html = await renderToStringAsync(() => <App />);
Last updated: 7/4/26, 6:21 PMEdit this pageReport an issue with this page