Just a hobbyist programmer with an eye on new technologies. Currently helping Quasar and NestJS Frameworks, because....well.....because they're awesome! :-)
There is a helper function for destructuring a reactive object called toRefs(). So, in the end, you can just use reactive objects and destructure them with toRefs().
ref.value is mutable, and if the inner value of your ref is an object it is deeply reactive. E.g.: myObjectRef.value.bar.foo = "5" will trigger any watcher on myObjectRef
Hey! I'm YCMJason, a Software Engineer in London ๐จโ๐ป. Love diving into tech puzzles and sharing them! ๐งฉ
All views expressed here are my own opinions, so please take them with a pinch of salt! ๐ง
Another great benefit of refs is that if you return an object where each property is a ref from a composition function, you can destructure it safely.
There is a helper function for destructuring a reactive object called toRefs(). So, in the end, you can just use reactive objects and destructure them with toRefs().
Scott
Are the return types from ref().value recursive read-only?
Or are they still mutable? Are they reactive if so?
ref.value
is mutable, and if the inner value of your ref is an object it is deeply reactive. E.g.:myObjectRef.value.bar.foo = "5"
will trigger any watcher onmyObjectRef
If it is a computed ref, then I believe it will be recursively read-only.