Recall & Review
beginner
What is the main purpose of using Svelte components inside an Astro project?
Svelte components let you build interactive parts of your website with a simple, reactive framework, while Astro handles the overall page structure and static content efficiently.Click to reveal answer
beginner
How do you import a Svelte component into an Astro file?Use the syntax: <code>import ComponentName from './ComponentName.svelte';</code> at the top of your Astro file.Click to reveal answer
beginner
How do you include a Svelte component in the Astro page template?
After importing, use the component as a tag like
<ComponentName /> inside the Astro file's HTML section.Click to reveal answer
intermediate
What is a key benefit of using Svelte components in Astro compared to plain HTML?
Svelte components provide reactivity and interactivity with less code and better performance, while Astro optimizes loading by only sending needed JavaScript.
Click to reveal answer
intermediate
Can you pass props to a Svelte component inside Astro? How?
Yes, pass props like HTML attributes:
<ComponentName prop1="value" />. The Svelte component receives them as usual props.Click to reveal answer
How do you add a Svelte component to an Astro page?
✗ Incorrect
You import the Svelte component at the top of the Astro file and then use it as a tag in the template.
What file extension do Svelte components use?
✗ Incorrect
Svelte components always use the .svelte file extension.
Which of these is a benefit of using Svelte components in Astro?
✗ Incorrect
Svelte components provide reactive UI and Astro optimizes JavaScript delivery for performance.
How do you pass data to a Svelte component in Astro?
✗ Incorrect
Props are passed as attributes on the component tag, just like HTML attributes.
What happens if you don't import a Svelte component before using it in Astro?
✗ Incorrect
Astro requires explicit imports; missing imports cause build errors.
Explain how to use a Svelte component inside an Astro page from import to rendering.
Think about how you bring a component in and then place it in the page.
You got /3 concepts.
Describe the benefits of combining Svelte components with Astro for building websites.
Consider what each tool does best and how they work together.
You got /4 concepts.