Challenge - 5 Problems
Vue Project Structure Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Understanding the role of the 'src' folder in a Vue project
In a typical Vue 3 project, what is the main purpose of the 'src' folder?
Attempts:
2 left
💡 Hint
Think about where you write your Vue components and main app logic.
✗ Incorrect
The 'src' folder is where you write your Vue components, views, and main app setup files like main.js or main.ts. It is the core source code folder.
❓ component_behavior
intermediate2:00remaining
Behavior of components inside the 'components' folder
What is the typical use of the 'components' folder inside the 'src' directory in a Vue project?
Attempts:
2 left
💡 Hint
Think about components you want to reuse in different parts of your app.
✗ Incorrect
The 'components' folder is for reusable Vue components that can be imported and used in different views or other components.
📝 Syntax
advanced2:00remaining
Correct import path for a component in Vue 3
Given a Vue project structure where
src/components/Button.vue exists, which import statement correctly imports this Button component into src/views/Home.vue?Attempts:
2 left
💡 Hint
Consider the relative path from 'views' folder to 'components' folder.
✗ Incorrect
The 'views' folder is inside 'src', so to reach 'components' from 'views', you go up one level with .. then into 'components'.
🔧 Debug
advanced2:00remaining
Identifying the cause of a missing component error
You see the error 'Failed to resolve component: Navbar' when running your Vue app. Your project structure has
src/components/Navbar.vue and you imported it in src/App.vue with import Navbar from './components/Navbar.vue'. What is the most likely cause?Attempts:
2 left
💡 Hint
Check if you declared the component properly after importing.
✗ Incorrect
Importing a component is not enough; you must also register it in the components option or use <script setup> to make it available in the template.
❓ lifecycle
expert3:00remaining
Order of lifecycle hooks in a Vue 3 component
What is the correct order of these Vue 3 lifecycle hooks when a component is created and mounted? Options list the hooks in order.
Attempts:
2 left
💡 Hint
Remember the lifecycle starts before creation and ends after mounting.
✗ Incorrect
The Vue 3 lifecycle order is: beforeCreate, created, beforeMount, then mounted.