Replies: 6 comments 3 replies
-
I've actually thought about this, but Something like |
Beta Was this translation helpful? Give feedback.
-
It's not more cryptic than $$ stuff from reactivity transform // reactivity transform
let count = $ref(0)
trackChange($$(count))
// .value replacement
const count = ref(0);
doSomething(count.$) Another reason is that it's easily searchable (searching for |
Beta Was this translation helpful? Give feedback.
-
That is why it should be a shortcut. |
Beta Was this translation helpful? Give feedback.
-
FYI I moved this to RFCs discussions. |
Beta Was this translation helpful? Give feedback.
-
My vote is a no. This is cryptic and introduces 2 different names for the same thing. I have written plenty of code with
I would love to see some real numbers before this is used as an argument, because I doubt it'd make a significant difference, especially not after gzip.
|
Beta Was this translation helpful? Give feedback.
-
What problem does this feature solve?
To access the value of a
ref()
you use.value
. While.value
is very explicit it is maybe also too long? I suggest adding a.v
shortcut for.value
.The use case for
.v
is the same as.value
but just a neat shortcut. I think this will improve the end user experience because you have to do less typing. Shortcuts can make using a framework more enjoyable just like the : shortcut for v-bind and @ for v-on.I also think it is nice because the framework is called Vue and then access the
.v
attribute the whole time. But it should also make bundle sizes smaller because.v
is 5 times as less text than.value
and this might make a difference if you have a large project.I think
.v
still makes it as clear what you are doing as.value
but it is just much faster and nicer to type.What does the proposed API look like?
Here is are two examples:
You could also mix them:
Beta Was this translation helpful? Give feedback.
All reactions