Load Data on a SvelteKit Page with +page.js load Function

Share this video with your friends

Send Tweet

We have some dummy data that we will use to get a grasp on data loading patterns in SvelteKit. Each route gets its on +page.svelte but we can also provide a route with a +page.js file that allows us to load data and expose it to our page.

You'll learn how this +page.js exports a load function that exposes a data object to the page you are loading data to. During this process, we'll use JSDoc to type our page data for some nice types.