Recall & Review
beginner
What is a
composable in Vue 3?A composable is a reusable function that uses Vue's reactive APIs to share state and logic across components.
Click to reveal answer
beginner
Which Vue 3 API is commonly used inside composables to create reactive state?
The
ref() and reactive() APIs are used to create reactive state inside composables.Click to reveal answer
intermediate
Why use composables instead of putting all logic inside components?
Composables help keep code clean and reusable by separating logic from component templates, making it easier to share and test.
Click to reveal answer
intermediate
How do you return reactive state from a composable?
Return the reactive variables (created with
ref() or reactive()) from the composable function so components can use them.Click to reveal answer
advanced
What happens if you call a composable multiple times in different components?
Each call creates a new independent reactive state, so components do not share state unless explicitly designed to do so.
Click to reveal answer
Which Vue API creates a single reactive value inside a composable?
✗ Incorrect
ref() creates a reactive single value, while reactive() creates a reactive object.What is the main benefit of using composables in Vue 3?
✗ Incorrect
Composables let you reuse logic and reactive state easily across multiple components.
If you want to share reactive state between components, what should you do?
✗ Incorrect
Sharing the same reactive object instance from a composable allows components to share state.
Which Vue 3 feature is NOT typically part of a composable?
✗ Incorrect
Composables contain logic and reactive state but do not include template HTML.
What does
reactive() do in a composable?✗ Incorrect
reactive() wraps an object to make all its properties reactive.Explain what a composable with reactive state is in Vue 3 and why it is useful.
Think about how you can reuse code and state in multiple places.
You got /4 concepts.
Describe how you would create and use a simple composable that holds a counter state.
Imagine making a small reusable counter logic.
You got /4 concepts.