Rendering

renderToStringAsync

Edit this page
import { renderToStringAsync } from "solid-js/web"
function renderToStringAsync<T>(
fn: () => T,
options?: {
timeoutMs?: number
renderId?: string
nonce?: string
}
): Promise<string>

Same as renderToString except that it will wait for all <Suspense> boundaries to resolve before returning the results. Resource data is automatically serialized into the script tag and will be hydrated on client load.

renderId is used to namespace renders when having multiple top level roots.

const html = await renderToStringAsync(App)

Options

timeoutMs

Type: number

The number of milliseconds to wait for a <Suspense> boundary to resolve before timing out.

renderId

Type: string

The id to use for the render.

nonce

Type: string

The nonce to use for the script tag.

Report an issue with this page