filmov
tv
02 Convert App Component to Vue js Composition Api | Moving from Option API to Composition API

Показать описание
In the Option API, we use various things like data properties, methods, hooks, etc. So, I'll convert them into the Composition API.
The most important thing is setup. We use the setup keyword to remove boilerplate from the component and make it simpler and easier to maintain.
Also, for methods, we don't need to create an object of methods and place all methods there. We can create our methods anywhere in the script, and they will be available in our component.
Similarly, we can create hooks like created and mounted with wrappers of onCreated() and onMounted() and then accept a function as its argument in Vuejs 3.
I love the Composition API because I don't need to specify my things in a specific object; I can define them anywhere in the component script tag.
Let's dive into the Vue js 3 composition API course.
/*========= Want to Hire me ======== */
* My WhatsApp: +923040738009