0
0
Svelteframework~5 mins

Component naming conventions in Svelte - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AUserProfile.svelte
Buserprofile.svelte
Cuser-profile.svelte
Duser_profile.svelte
Why should component names start with a capital letter in Svelte?
ATo avoid using quotes
BTo make the file size smaller
CTo improve performance
DTo distinguish components from HTML tags
Which naming style is discouraged for Svelte components?
APascalCase
BcamelCase
Ckebab-case
DUpperCamelCase
What is a good practice when naming page components in Svelte?
AUse random names
BUse names that reflect the page's purpose
CUse all lowercase letters
DUse numbers only
Consistent component naming helps with:
ACode readability and maintenance
BIncreasing file size
CSlowing down the app
DMaking code harder to understand
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.