Recall & Review
beginner
What does the
reactive function do in Vue?It creates a reactive object that Vue tracks for changes, so the UI updates automatically when the object's properties change.
Click to reveal answer
beginner
How do you create a reactive object with Vue's Composition API?
Use <code>import { reactive } from 'vue'</code> and then call <code>const state = reactive({ key: value })</code>.Click to reveal answer
beginner
Why should you use
reactive instead of a plain JavaScript object in Vue?Because Vue can detect changes in reactive objects and update the UI automatically, while plain objects won't trigger updates.
Click to reveal answer
intermediate
Can you add new properties to a reactive object after creation and have Vue track them?
Yes, Vue 3's reactive system tracks new properties added to reactive objects, so the UI updates when they change.
Click to reveal answer
intermediate
What is the difference between
reactive and ref in Vue?reactive makes an entire object reactive, while ref makes a single value reactive and wraps it in an object with a .value property.Click to reveal answer
What does Vue's
reactive function return?✗ Incorrect
The
reactive function returns a proxy object that Vue uses to track changes and update the UI.Which Vue import is needed to use
reactive?✗ Incorrect
The
reactive function is part of Vue's core and imported from 'vue'.If you change a property inside a reactive object, what happens?
✗ Incorrect
Vue tracks changes in reactive objects and updates the UI automatically when properties change.
Can you use
reactive with arrays?✗ Incorrect
Vue's
reactive can make arrays reactive, tracking changes like push or pop.What is a key difference between
reactive and ref?✗ Incorrect
ref is for single values and uses a .value property, while reactive wraps whole objects.Explain how Vue's
reactive function helps keep the UI updated automatically.Think about how Vue watches for changes in data.
You got /4 concepts.
Describe the difference between using
reactive and ref in Vue's Composition API.Consider what kind of data each is best for.
You got /4 concepts.