Replies: 1 comment
-
The If you want to pass dynamic data from the layout to the child pages you can use the contextApi
//+page.svelte
<script>
import { getContext } from 'svelte';
const messages = getContext('message-context');
</script>
<h1>{$message}</h1> //notice it is a store now Now whenever the store in layout changes it will change in the child as well (note that here the opposite is also true, this is a good way to also communicate upwards from child to layout). You can do |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
While in svelte, this code is ok, in sveltekit this is not ok. Could anyone help me figure out what sveltekit have did to the route as the docs seems so simple and need more cases. BTW, sveltekit seems have changed some features in the svelte, like this slot props?
https://replit.com/@cgxxv/sveltekit-demo#src/routes/+layout.svelte
Beta Was this translation helpful? Give feedback.
All reactions