mirror of
https://github.com/Dvorinka/Devour.git
synced 2026-06-04 12:33:04 +00:00
17 lines
2.3 KiB
JSON
17 lines
2.3 KiB
JSON
{
|
|
"id": "11f1ed15519f1c0f5562e354",
|
|
"source": "solid:signals",
|
|
"type": "github-document",
|
|
"title": "render",
|
|
"content": "---\ntitle: render\nuse_cases: \u003e-\n app initialization, mounting components, spa entry point, client-side\n rendering, dom manipulation\ntags:\n - mounting\n - initialization\n - spa\n - dom\n - client\n - entry\nversion: '1.0'\ndescription: \u003e-\n Mount your Solid app to the DOM with render. The essential browser entry point\n for initializing and disposing client-side applications.\n---\n\n```ts\nimport { render } from \"solid-js/web\"\nimport type { JSX } from \"solid-js\"\nimport type { MountableElement } from \"solid-js/web\"\n\nfunction render(\n code: () =\u003e JSX.Element,\n element: MountableElement\n): () =\u003e void\n\n```\n\nThis is the browser app entry point.\nProvide a top-level component function and an element to mount to.\nIt is recommended this element be empty: while `render` will just append children, the returned dispose function will remove all children.\n\n```ts\nconst dispose = render(App, document.getElementById(\"app\"))\n// or\nconst dispose = render(() =\u003e \u003cApp /\u003e, document.getElementById(\"app\"))\n```\n\nIt's important that the first argument is a function: do not pass JSX directly (as in `render(\u003cApp/\u003e, ...)`), because this will call App before render can set up a root to track signal dependencies within App.\n\n## Parameters\n\n| Argument | Type | Description |\n| -------------------- | ------------------- | ----------------------------------------------- |\n| code | `() =\u003e JSX.Element` | Function that returns the application code. |\n| element | MountableElement | DOM Element to mount the application to |",
|
|
"url": "https://github.com/solidjs/solid-docs/blob/HEAD/src/routes/reference/rendering/render.mdx",
|
|
"metadata": {
|
|
"path": "src/routes/reference/rendering/render.mdx",
|
|
"repo": "solidjs/solid-docs",
|
|
"repo_url": "https://github.com/solidjs/solid-docs.git",
|
|
"size": 1618,
|
|
"source_type": "github"
|
|
},
|
|
"hash": "5170fedfa35d4664270241e34fb307736239b7677948c70af1da109278b1e7c4",
|
|
"timestamp": "2026-02-23T11:43:00.190478983+01:00"
|
|
} |