Vue · Middle · Question 7 of 75
What is a writable computed?
const fullName = computed({
get: () => `${first.value} ${last.value}`,
set: (v) => { [first.value, last.value] = v.split(" "); },
});- ✓Correct answer: A computed with a getter and a setter, so assigning to it updates the underlying state
- 2A computed that caches values in
localStorage - 3Any computed - all of them can be assigned
Explanation
By default computed refs are read-only. A setter is useful for v-model on derived values; the getter still must be pure.