Replies: 1 comment
-
Let's say you navigate to // /books/+layout.server.js
export function load() {
return { totalBooks: 311 }
}
// /books/fantasy/+layout.server.js
export function load() {
return { genreBooks: 56 }
}
// /books/fantasy/[bookId]/+page.server.js
export function load() {
return { title: 'The Color of Magic' }
} For all components, the value of {
totalBooks: 311,
genreBooks: 56,
title: 'The Color of Magic'
} But the value of the // /books/+layout.svelte
export let data = { totalBooks: 311 }
// /books/fantasy/+layout.svelte
export let data = { totalBooks: 311, genreBooks: 56 }
// /books/fantasy/[bookId]/+page.svelte
export let data = { totalBooks: 311, genreBooks: 56, title: 'The Color of Magic' } Note how the data prop in The benefit of using the For more, see the documentation for $page.data. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Faced this few times in the past but have totally forgotten what it was, so happy if anyone remembers
Beta Was this translation helpful? Give feedback.
All reactions