Why You Don't Need The Vue.js 3 Composition API! Composition API vs Options API Vue.js 3 comparision

preview_player
Показать описание

👉Check out my last video on Watch vs WatchEffe4ct

👉 Sign up and get free Vue cheat sheets and updates!

Need some mentoring, help with a project, get a career in tech, level up your skills? Check it out

Need to Learn Vue or Nuxt? Check out my courses below!

0:00 Introduction
0:40 Options API
03:17 Composition API
05:32 Script Setup
07:02 Hybrid Approach

🗂️ 🗂️ 🗂️

Links
Рекомендации по теме
Комментарии
Автор

👉 Sign up and get free Vue cheat sheets and updates!

ProgramWithErik
Автор

Having worked with both Options API and Composition API, I have fallen in love with Composition API with script setup. Using it with TS, and JS is ❤ again! 😊

AkshaySood
Автор

Maybe it's because I'm so comfortable with it, but I really like the Vue.js 2 way of doing things. It forces developers to be organized. And yeah, I know that's what turns a lot of devs off of Vue 2. But it's what I like about it.

Algebrodadio
Автор

Composition API in my opinion feels clean and natural. I much prefer it compared to Options. In the end it is up to you which one you are more comfortable with.

mcvgs
Автор

I got into vusejs because the options api seemed less complex than react. Now having built a number of applications with react, the composition api in vuejs makes me just want to develop using react.

TysonLondon
Автор

As someome relatively new to Vue, the options API feels more approachable and intuitive to use. And more organised.

danielmbirch
Автор

This was really helpful, since I'm somewhat a beginner with Vue and didn't get the full meaning of the APIs. Maybe you want to do an (even) shorter video stating just the basics and maybe referring to this one. I could imagine people watching it just to get the APIs.

simonschroder
Автор

The only thing I do miss going from the Options API to Composition is inheritance. I miss being able to "classically" extend a component to a child component, and I've never been a fan of composing my extensions. The ability to extend components like that was the main reason I went from React to Vue, and the Composition API in Vue seems like it's trying to follow React's paradigm. Granted, Vue's Composition API is far less hacky than React's Hooks API, but it still feels like Vue is just trying to be more like React for the sake of being more like React.

One thing you left out -- Pinia primarily works with the Composition API (specifically the setup() function). It'll work with the Options API, but integration is much simpler with setup(). At least, it was for me. So, if you're planning to use Vuex's replacement or start a Nuxt 3 project, it's likely you're better off going the Composition route.

uyk
Автор

Don't know if anybody else pointed this out already, but using the hybrid approach you can actually access the refs and functions returned by the setup method in your options API code just fine by using "this".

SknRock
Автор

After fiddling for a bit with TS+ESLint with the Options API I came to the conclusion that this particular config is unusable (lots of false positives involving `this` keyword being undefined) I went head on for Composition API and never looked back.

adin
Автор

Always options api easy organised and the very reason why i fell in love with vue,

bharathhs
Автор

Could you explain how to build and more importantly test services using composition API? Would you even put business logic in composable "services" in a non trivial prod app?

ShamanS
Автор

Nice videos ! Very helpful to refactor my projects :) I’ve seen that you were offering mentoring before is it still a thing ? Cause I would be very interested

jonathanbereyziat
Автор

Thank you. It's very useful for me

nontkung
Автор

finally....! thanks for saying this... i was so sick of people saying composition api is going to "replace" options api...

aj.arunkumar
Автор

Composition API: When multiple components need the same ancestor data, or when a deeply nested component needs ancestor data
Options API: When a child component needs parent data

AdroSlice
Автор

Can we get a video on fetching with nuxt 3?

QtheCoder
Автор

Honestly, just for the TS support the composition API is worth it.

folkrav
Автор

web 3 ? YEAH ABSOLUTELY!!...a solana app would be awesome!

Smoonwalkerm
Автор

What the heck, how do you get glowing syntax?? That color scheme is awesome

Sirfrummel