Essentially, the question is quite clear from the title: In Vue.js 3, why is it necessary to use the value
property with ref
, but not with reactive
?
I comprehend that ref
is meant for simple values like booleans and numbers, while reactive
is used for more complex values such as objects and arrays. However, what confuses me is:
- Why must I specify
value
when retrieving a value from aref
, yet this is not required withreactive
? Is this an inconsistency in the API, or is there a legitimate technical rationale behind it? - Why is it not possible to use a single method for both scenarios? In simpler terms, is there a technical explanation for the absence of a universal function that adapts based on the data type, internally wrapping it accordingly?
I understand that there might be more to it than meets the eye. Can anyone offer some insight?