mirror of
https://github.com/Dvorinka/Devour.git
synced 2026-06-03 20:13:03 +00:00
17 lines
2.3 KiB
JSON
17 lines
2.3 KiB
JSON
{
|
|
"id": "19298be4eaf00db213fe69b6",
|
|
"source": "solid:signals",
|
|
"type": "github-document",
|
|
"title": "use-preload-route",
|
|
"content": "---\ntitle: usePreloadRoute\nuse_cases: \u003e-\n performance optimization, manual preloading, predictive navigation,\n prefetching routes\ntags:\n - preload\n - performance\n - optimization\n - prefetch\n - manual\nversion: \"1.0\"\ndescription: \u003e-\n Manually preload routes with usePreloadRoute - optimize performance by\n prefetching route data before navigation in your SolidJS app.\n---\n\nThe `usePreloadRoute` function is a utility for manually preloading a route.\n\n## Import\n\n```ts\nimport { usePreloadRoute } from \"@solidjs/router\";\n```\n\n## Type\n\n```ts\nconst usePreloadRoute: () =\u003e (\n\turl: string | URL,\n\toptions?: { preloadData?: boolean }\n) =\u003e void;\n```\n\n## Parameters\n\n### `url`\n\n**Type:** `string | URL`\n**Required:** Yes\n\nThe route path to preload.\nAccepts either a `string` path or a [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) object.\n\n### `options`\n\n- **Type:** `{ preloadData?: boolean }`\n- **Required:** No\n\nA configuration object with the following properties:\n\n#### `preloadData`\n\n- **Type:** `boolean`\n- **Default:** `false`\n\nWhen `true`, triggers the route's data loading in addition to preloading the route itself.\n\n## Return value\n\nNone.\n\n## Examples\n\n### Basic usage\n\n```tsx\nimport { usePreloadRoute } from \"@solidjs/router\";\n\nfunction SettingsButton() {\n\tconst preload = usePreloadRoute();\n\n\treturn (\n\t\t\u003cbutton onClick={() =\u003e preload(\"/users/settings\", { preloadData: true })}\u003e\n\t\t\tLoad settings\n\t\t\u003c/button\u003e\n\t);\n}\n```\n\n## Related\n\n- [`\u003cA\u003e`](/solid-router/reference/components/a)\n- [`preload`](/solid-router/reference/preload-functions/preload)",
|
|
"url": "https://github.com/solidjs/solid-docs/blob/HEAD/src/routes/solid-router/reference/primitives/use-preload-route.mdx",
|
|
"metadata": {
|
|
"path": "src/routes/solid-router/reference/primitives/use-preload-route.mdx",
|
|
"repo": "solidjs/solid-docs",
|
|
"repo_url": "https://github.com/solidjs/solid-docs.git",
|
|
"size": 1570,
|
|
"source_type": "github"
|
|
},
|
|
"hash": "23efcb73ba285bf6f070c64c6225cdf19ad0dae81b5f857ee0fd26ac2de969ce",
|
|
"timestamp": "2026-02-23T11:43:00.193206579+01:00"
|
|
} |