Last active
January 23, 2022 08:54
-
-
Save Theo-Steiner/70c2cd0839c281bd3759a35625582376 to your computer and use it in GitHub Desktop.
Show page at a different route than its original route
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to show a route 'a' at route 'b' even with running the module script. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- src/routes/a.svelte --> | |
<script context="module"> | |
export async function load({page}) { | |
return { | |
props: { | |
path: page.path | |
} | |
} | |
} | |
</script> | |
<script> | |
export let path; | |
</script> | |
<h1>Hello from page A, currently at path: {path}</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- src/routes/b.svelte --> | |
<script context="module"> | |
import A, { load } from "./a.svelte"; | |
export { load } | |
</script> | |
<A ...{$$props} /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment