{
  "id": "8018923d4113e472e785aa0e",
  "source": "solid:signals",
  "type": "github-document",
  "title": "render-to-string",
  "content": "---\ntitle: renderToString\nuse_cases: \u003e-\n  basic ssr, static site generation, synchronous rendering, progressive\n  hydration, seo pages\ntags:\n  - ssr\n  - rendering\n  - hydration\n  - synchronous\n  - static\nversion: '1.0'\ndescription: \u003e-\n  Generate HTML strings synchronously with renderToString. Perfect for SSR with\n  progressive hydration and static site generation needs.\n---\n\n```ts\nimport { renderToString } from \"solid-js/web\"\n\nfunction renderToString\u003cT\u003e(\n\tfn: () =\u003e T,\n\toptions?: {\n\t\tnonce?: string\n\t\trenderId?: string\n\t}\n): string\n\n```\n\nRenders to a string synchronously.\nThe function also generates a script tag for progressive hydration.\nOptions include eventNames to listen to before the page loads and play back on hydration, and nonce to put on the script tag.\n\n`renderId` is used to namespace renders when having multiple top level roots.\n\n```ts\nconst html = renderToString(App)\n```\n\n## Options\n\n| Name       | Type     | Description                          |\n| ---------- | -------- | ------------------------------------ |\n| `nonce`    | `string` | The nonce to use for the script tag. |\n| `renderId` | `string` | The id to use for the script tag.    |",
  "url": "https://github.com/solidjs/solid-docs/blob/HEAD/src/routes/reference/rendering/render-to-string.mdx",
  "metadata": {
    "path": "src/routes/reference/rendering/render-to-string.mdx",
    "repo": "solidjs/solid-docs",
    "repo_url": "https://github.com/solidjs/solid-docs.git",
    "size": 1169,
    "source_type": "github"
  },
  "hash": "b9b23d6a14022855d53f6b23808ab9397dc52a1de817d10b83ccf70fe840655c",
  "timestamp": "2026-02-23T11:43:00.190451592+01:00"
}