+layout slot properties #12729
-
I can't seem to pass properties from +layout.svelte to +page.svelte that fills the +layout.svelte <slot message='hello'/> +page.svelte <script>
export let message;
</script>
{message} message is not set. Feels like a trivial problem, but I can't find anything on it. Here is live code |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
the right solution is store, isn't it... |
Beta Was this translation helpful? Give feedback.
-
Use the layout's
|
Beta Was this translation helpful? Give feedback.
-
This happens due to how SvelteKit renders the Layout and page files. I think they are wrapped into a svelte element and therefore dont receive any slot props. You should either use context or load functions as Brunner suggested |
Beta Was this translation helpful? Give feedback.
Use the layout's
load
function.