mirror of
https://github.com/Dvorinka/Devour.git
synced 2026-06-03 20:13:03 +00:00
17 lines
1.8 KiB
JSON
17 lines
1.8 KiB
JSON
{
|
|
"id": "d07e6e630fef31f5be9f1ea1",
|
|
"source": "solid:signals",
|
|
"type": "github-document",
|
|
"title": "navigate",
|
|
"content": "---\ntitle: Navigate\nuse_cases: \u003e-\n automatic redirects, programmatic navigation, conditional routing, auth\n redirects, dynamic routing\ntags:\n - component\n - redirects\n - navigation\n - programmatic\n - dynamic\nversion: '1.0'\ndescription: \u003e-\n Navigate component provides immediate programmatic navigation and redirects,\n perfect for authentication flows and conditional routing logic.\n---\n\nSolid Router provides a `Navigate` component that works similarly to [`\u003cA\u003e`](/solid-router/reference/components/a), but it will _immediately_ navigate to the provided path as soon as the component is rendered.\nIt also uses the `href` prop, but with the additional option of passing a function to `href` that returns a path to navigate to:\n\n```jsx\nfunction getPath({ navigate, location }) {\n\t// navigate is the result of calling useNavigate(); location is the result of calling useLocation().\n\t// You can use those to dynamically determine a path to navigate to\n\treturn \"/some-path\";\n}\n\n// Navigating to /redirect will redirect you to the result of getPath\n\u003cRoute path=\"/redirect\" component={() =\u003e \u003cNavigate href={getPath} /\u003e} /\u003e;\n```",
|
|
"url": "https://github.com/solidjs/solid-docs/blob/HEAD/src/routes/solid-router/reference/components/navigate.mdx",
|
|
"metadata": {
|
|
"path": "src/routes/solid-router/reference/components/navigate.mdx",
|
|
"repo": "solidjs/solid-docs",
|
|
"repo_url": "https://github.com/solidjs/solid-docs.git",
|
|
"size": 1130,
|
|
"source_type": "github"
|
|
},
|
|
"hash": "14bc415f23df7646a73701b58d7a735d6ca30479126945254cb9103b79662714",
|
|
"timestamp": "2026-02-23T11:43:00.192457401+01:00"
|
|
} |