Closed
Description
the section proxy vs. original identity states that a proxy is not identical to the original object it wraps.
I assume proxy
means the use of reactive(myObject)
or ref(myValue)
.
Indeed,
let data = {myObject:{myNumber:3}}
let reactiveData = reactive(newData);
data === reactiveData; // → false
And it also applies to nested objects
data.myObject === reactiveData.myObject // → false
However, what the guide does not mention is that this does not apply to the properties as long as they are not objects themselves
data.myObject.myNumber === reactiveData.myObject.myNumber // → true
This also applies to the example which gives the caveat for the strong-comparison array methods like .find
let myArray = [1,2,3,4]
let myReactiveArray = reactive(myArray);
myReactiveArray.find(number => number === 2) === myArray[1] //→ true
My suggestions would be:
- Illustrate that
proxy
in vue can mean using the implicitly proxied values in the method’s API or ref/reactive in the composition API. - Tell, that while proxied objects are not equal their original, pass-by-value types (number,string) are.