Recall & Review
beginner
What are the three main sections of a .svelte component file?
A .svelte file typically has three main sections: <script> for JavaScript logic, <style> for CSS styling, and the markup section for HTML structure.
Click to reveal answer
beginner
What is the purpose of the <script> tag in a .svelte file?
The <script> tag holds the JavaScript code that controls the component's behavior, such as variables, functions, and imports.
Click to reveal answer
beginner
How does the <style> section in a .svelte file affect the component?
The <style> section contains CSS that styles the component. Styles are scoped, meaning they apply only to this component's markup.
Click to reveal answer
beginner
Can you write HTML directly inside a .svelte file? Where?
Yes, you write HTML markup directly in the .svelte file outside the <script> and <style> tags. This markup defines what the component renders.
Click to reveal answer
intermediate
How does Svelte handle reactivity inside a .svelte component?
Svelte tracks changes to variables declared in <script>. When these variables change, Svelte updates the HTML automatically without extra code.
Click to reveal answer
Which section of a .svelte file contains the CSS styles?
✗ Incorrect
The