I haven't touched Vue 3 yet so far, that make me curious, is it the composition API or that ref package which enable you not declaring data:function(){ ... } instead just use it directly under setup() function? I don't see newTodo is declared here yet you use it as v-model.
Normally, we use options api with vue 2. Options api included data, mounted, created etc. functions. On the other hand, composition api is included setup function. And then setup function is included onMounted, onBeforeMount, custom methods, ref definitions, etc. We cannot use ref outside of the setup function.
I haven't touched Vue 3 yet so far, that make me curious, is it the composition API or that
ref
package which enable you not declaringdata:function(){ ... }
instead just use it directly undersetup()
function? I don't seenewTodo
is declared here yet you use it as v-model.Normally, we use options api with vue 2. Options api included data, mounted, created etc. functions. On the other hand, composition api is included setup function. And then setup function is included onMounted, onBeforeMount, custom methods, ref definitions, etc. We cannot use ref outside of the setup function.
Thanks for explaining! Gonna learn Vue 3 soon!