0Pricing
Sveltejs Academy · Lesson

Shared Data Across Layouts

Load data in a parent layout and access it in child pages and layouts.

Layout Loads

A +layout.js or +layout.server.js can load data shared by all pages under it.

Accessing Data

The page receives data merged from all ancestor layouts and the page itself.

export let data;
// data has both layout and page properties

All lessons in this course

  1. Layout Groups with (group)
  2. Route-Level Layouts
  3. Breaking Out of a Layout with +page@route
  4. Shared Data Across Layouts
← Back to Sveltejs Academy