I'm using vue 3 composition api and I am struggling understanding setting vars, if I should use myVar.value or not?
For example, how should the following be set?
<script setup>
const active = ref(false);
function show(){
active = true;
active.value = true;
this.active = true;
}
Which way?
In the script tag, state defined using
ref()should be accessed using.value:In the template, state can be accessed directly :
If using defining state using
reactive(),.valueis not used :Documentation: Vue 3 Reactivity API: Core