Refs not unwrapped after reading from store #2708
-
Consider the this example. (Watch the browser console when using.) The Set button inserts a value into the store, but when reading it back with the Get button, I'm getting the ref-wrapped version that it practically unusable later in the code as is. However, type checking suggests that the retrieved value is not ref-wrapped. I get an error if I try to unwrap it with Is this expected behavior? Am I doing something wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's a proxy object but still an object: you can use it just like that (without |
Beta Was this translation helpful? Give feedback.
It's a proxy object but still an object: you can use it just like that (without
.value
). This is just Vue. Try reading any value that is a primitive and you will get the primitive value instead of a proxy (because primitives are always copied in JS)