# Making the web Svelter with SvelteKit ### Part 3 - Your very first component! [Back to part 2](part2_slides.html) --- ## Creating a site-wide component - Non-page components in Svelte usually live in /src/lib/components - /src/lib is a special directory that Svelte knows how to reach via - import component from '$lib'; - You, the developer decides the directory-structure within /src/lib - For small apps, a single "components" directory is sufficient - For larger apps, add related components to sub-directories --- ## Copy from +page.svelte - We will start by copying everything from +page.svelte to a new file: - /src/lib/components/Slideshow.svelte - Rename the ***data*** variable to photo - Update the each-loop --- ## Slideshow.svelte ```svelte [4, 12, 48-50]
{#each photos as photo}
{/each}
``` --- ## Strip-down +page.svelte ```svelte [] ``` --- ## Import and use the Slideshow.svelte component ```svelte [2, 7]
``` --- ## Onwards [part 4](part4_slides.html)