Svelte · Middle · Question 35 of 75

How does a page load get data from its layout's load?

export async function load({ parent }) {
  const { user } = await parent();
  return { posts: await getPosts(user.id) };
}

Explanation

Call parent() after starting independent work, otherwise you create a waterfall.

Further reading

Problem with a question

Svelte · Middle · question 35

Test yourself

Take the Svelte · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz