Layouts
A layout is a view that wraps other views. It holds the chrome every page shares, and marks where the page goes with <Slot/>. When the route changes, the router swaps the view inside the slot and leaves the layout in place.
A route picks its layout with a layout key, next to view.
Your turn
- Cut the
<header>out ofShop.pzland paste it intolayouts/Default.pzl, above<main>. - Delete the header from
Playlist.pzltoo. Each view now only needs its own content, so drop their<main>wrappers as well: the layout has one. - In
routes.js, import the layout and give both routeslayout: Default.
import Default from './layouts/Default.pzl';
A route can nest further with children. The child renders at the parent view's own <Slot/>, and its path is relative to the parent's.