Vue Reactive
up:: Vue Composition API
Use Reactive for Objects
Where Vue Refs reactive works with any kind of value, reactive
works only for objects.
const user = reactive({
name: 'Maximilian',
age: 31,
});
setTimeout(() => {
user.name = 'Max';
user.age = 32;
}, 2000);
return { userName: userName } // You still expose the whole object.
The benefit is that you don’t have to use object.value.property
.