Vue · Junior · Question 75 of 75
Why can a ref declared with const still change?
const count = ref(0)
count.value++ // works- ✓Correct answer:
constonly prevents reassigning the variable; the ref object's.valueis still mutable - 2
constmakes the ref read-only, so this throws - 3Refs must be declared with
let
Explanation
Writing count = ref(1) would fail and also break every place that holds the old ref. Use readonly() to make a value truly read-only.