Inconsistency with the need for `.value` between `ref`, `reactive`, and `computed`
Version
3.2.0-beta.7
Reproduction link
Steps to reproduce
Try to access ref
, reactive
, and computed
properties in code (not in the template).
What is expected?
Consistency in the need for .value
in code.
What is actually happening?
ref
and computed
require the use of .value
while reactive
does not.
It's difficult to remember in which cases you need .value
and in which cases you don't. If there is a good reason for this from a consuming developer's perspective it should be called out very clearly in the docs. Otherwise, it would be nice if reactive also worked consistently. In order to avoid a breaking change, you could allow, but not require, .value
to be used on reactive
objects.
This is already described in the docs. If you have suggestions, open a PR ain't he docs repo.
You can find the full explanation in the RFC if you want to understand why but it is not necessary in order to use them
The change you are proposing would forbid adding a property named value in a reactive object
@posva Can you link to where in the docs you are referring to? I've been looking for a good explanation and I'd be willing to make a PR if I knew the right place. What you said about my suggestion not allowing a property named value makes sense though.
https://v3.vuejs.org/guide/composition-api-introduction.html. You can find the RFC in the rfcs repo