DEV Community

loading...

Discussion on: Create ToDo App With Vue 3 Composition API

Collapse
chandragie profile image
chandragie • Edited

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.

Collapse
burakgur profile image
Burak Gür Author

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.

Collapse
chandragie profile image
chandragie

Thanks for explaining! Gonna learn Vue 3 soon!