Recall & Review
beginner
Why should Svelte component names start with a capital letter?
Starting component names with a capital letter helps Svelte and developers distinguish components from regular HTML elements. It improves readability and prevents naming conflicts.
Click to reveal answer
beginner
What is the recommended file naming style for Svelte components?
Svelte components should be saved with PascalCase file names, like
MyComponent.svelte. This matches the component name and helps keep the project organized.Click to reveal answer
intermediate
How should you name components that represent UI elements versus pages in Svelte?
UI elements usually have descriptive names like
Button or Modal. Pages often use names that reflect their route or purpose, like HomePage or UserProfile.Click to reveal answer
beginner
What naming style is NOT recommended for Svelte components?
Using lowercase or kebab-case (like
my-component.svelte) for component files is not recommended because it can confuse Svelte and developers, making it harder to identify components.Click to reveal answer
intermediate
Why is consistent component naming important in Svelte projects?
Consistent naming makes the code easier to read, maintain, and scale. It helps new team members understand the project quickly and reduces errors caused by misnaming.
Click to reveal answer
Which of these is the correct way to name a Svelte component file?
✗ Incorrect
Svelte components should use PascalCase file names matching the component name, like UserProfile.svelte.
Why should component names start with a capital letter in Svelte?
✗ Incorrect
Capital letters help distinguish components from regular HTML elements, improving clarity.
Which naming style is discouraged for Svelte components?
✗ Incorrect
kebab-case is discouraged because it can confuse Svelte and developers when identifying components.
What is a good practice when naming page components in Svelte?
✗ Incorrect
Page components should have descriptive names that reflect their purpose, like HomePage or UserProfile.
Consistent component naming helps with:
✗ Incorrect
Consistent naming improves readability, maintenance, and teamwork.
Explain why Svelte components should be named using PascalCase and start with a capital letter.
Think about how you tell a friend apart from a place by their names.
You got /3 concepts.
Describe the difference in naming conventions between UI element components and page components in Svelte.
Consider how you name small tools versus big rooms in a house.
You got /3 concepts.