Vue 3 Script Setup, The Future Of Vue? Tutorial And Setup

  Рет қаралды 59,664

Program With Erik

Program With Erik

Күн бұрын

Пікірлер: 140
@Frank-Lee-Speeking
@Frank-Lee-Speeking 5 ай бұрын
This is the video I've been needing! Finally, a proper explanation of the difference in usage and coding between , with the setup{} function, and !! Bravo to you, Erik! Now, if only all those old videos that used just or with {setup} could be magically remade to use ....
@otahak
@otahak 2 жыл бұрын
Man, I'm usually pretty good about figuring things out from official documentation, but after three days of banging my head against the wall trying to understand props and their correct syntax your video is the first time I've understood/achieved passing data between components. Looking forward to your other videos!
@noblesavage149
@noblesavage149 3 жыл бұрын
Anyone else getting ready for Nuxt 3? :) Keep up the good work Erik
@wobsoriano
@wobsoriano 3 жыл бұрын
me! Excited to migrate my current project from
@ลุงยุทธ์ยันกัญชา
@ลุงยุทธ์ยันกัญชา Жыл бұрын
From vue2 to vue3, we had to change a lot of ways of using it. very easy to understand Even though I'm not very good at English, thank you very much.
@wobsoriano
@wobsoriano 3 жыл бұрын
is the future. Add in volar vscode extension for template inference!
@NeilCarpenter-ru9vh
@NeilCarpenter-ru9vh Жыл бұрын
I've been using the options for several years now and quite comfortable using it. We're going to try using the composition API on our next project, mainly for the composable features, but there are a few things that concern me a bit. I actually like how things are organised using the options API... having all my methods together, all my probs together, all my data together is fantastic for me and I feel like with the composition API things are going to end up all over the place. I'll see how it goes. Thanks for this video though - think I'll have to watch it through a couple of times because I got a bit lost towards the end. Thanks again.
@antifa_communist
@antifa_communist Жыл бұрын
In the options API you're just forced to have them together. If you want, just make some comments around where each thing.
@irishbruse
@irishbruse 3 жыл бұрын
I just started learning vue a month ago and this is what i used for my website it works great its just less boiler plate and the functions for props make it easy to tell if the component takes in props
@alex_blue5802
@alex_blue5802 Жыл бұрын
Wow, I'm very impressed by the setup script. I've been using the options API thus far and it was fine, but this is next-level when it comes to intuitive and elegant coding. I'll be using this in the future.
@yanyam7700
@yanyam7700 3 жыл бұрын
Okay I've been fidgeting with this new way for 2 days just about, and I love it. This definitely makes the composition API much more bareable for me, even though its small, it does matter.
@_moon7157
@_moon7157 2 жыл бұрын
Awesome explanation! I just totally got them real quick thanks to you! Thank you from South Korea.
@ProgramWithErik
@ProgramWithErik 2 жыл бұрын
Glad it helped!
@SvingitGolf
@SvingitGolf 2 жыл бұрын
I have started to use this. The code gets cleaner and easier to read in this way.
@ProgramWithErik
@ProgramWithErik 2 жыл бұрын
Yeah I think so too!
@TarikBoschi
@TarikBoschi 3 жыл бұрын
Excellent demo. It's amazing sugar syntax. Very similar to Svelte
@miladrezai14
@miladrezai14 2 жыл бұрын
so which one should i learn as begginer for find a job ?
@dontqsy5101
@dontqsy5101 2 жыл бұрын
@@miladrezai14 Between svelte and vue? Vue has more job oportunities
@contractorwolf
@contractorwolf 2 жыл бұрын
Erik, great video. We just started the transition this week from Options API and I was already loving the "script setup" but your video really filled in the gaps of knowledge and answered a bunch of the questions I had. Thanks!
@amirrezam75
@amirrezam75 2 жыл бұрын
That's what I needed to know in order to migrate from vue 2 to 3. Thanks❤
@ProgramWithErik
@ProgramWithErik 2 жыл бұрын
Great!
@metronomo1676
@metronomo1676 3 жыл бұрын
Very nice video! Thanks for all the knowlegde Erik. If someone has ESLint activated and receive the error "The keyword 'interface' is reserved" must update ESLint version (removing his typescript dependencies previously and after the update reinstalling them). I received the error with ESLint 6.32.0 and now I have the 8.0.0 ESLint version and works fine.
@javadnoroozi2081
@javadnoroozi2081 2 жыл бұрын
Exactly what i needed to migrate from vue 2 to 3 Thanks ❤👍
@LofiCoder
@LofiCoder 3 жыл бұрын
really need this, everybody is talking about it.
@dimakovalenkov7835
@dimakovalenkov7835 2 жыл бұрын
Thank You! I'm just starting to learn Vue and immediately want to learn a new syntax, it's even neater = )
@mohamedruslicali5926
@mohamedruslicali5926 3 жыл бұрын
Hello. Can I ask what color theme you used?
@TheInsaneFear
@TheInsaneFear 3 жыл бұрын
Great video, i'm loving the new script setup. Define props using typescript directly is really good. One tip, in your HelloWorld example you don't need to implicit set inheritAttrs to false because it's a multi-root node component, so the inheritance is disabled by default, you just need to disable inheritance when using a single root node and you want the binding to be in some child of this root element.
@JeremiahFulbright
@JeremiahFulbright 2 жыл бұрын
Excellent! What extension are you using that added the `setup sugar` and `pug` notations?
@elultimopujilense
@elultimopujilense 2 жыл бұрын
Awesome video! even better than the docs!
@igordasunddas3377
@igordasunddas3377 3 жыл бұрын
This video definitely convinced me to subscribe! Thank you for quality content!
@Tassaczek
@Tassaczek 2 жыл бұрын
Fun Fact: you could use Vue2 with Class Base Components and vue property decorator and have this for a long time :) So script setup makes way easier to move to vue3 :)
@cswalker21
@cswalker21 2 жыл бұрын
Thanks, good video. I definitely think this is part of the right direction that Vue is moving. Along with Pinia, this is reducing extraneous and cryptic boilerplate and I love it.
@cnikolov
@cnikolov 3 жыл бұрын
from 3.2 I personally like the most the custom components registration.
@hamil1806
@hamil1806 2 жыл бұрын
Great explanation! Actually you can pass event to props in different way
@alias_one11depapel81
@alias_one11depapel81 3 жыл бұрын
That was super great! Thank you and i will check out your fututre vue 3 courses. I hope its in typescript too.
@ProgramWithErik
@ProgramWithErik 3 жыл бұрын
Glad you liked it!
@0x3333
@0x3333 2 жыл бұрын
Dude, you just nailed it! 👏
@ferryhtw
@ferryhtw 2 жыл бұрын
This video help me a lot! Thank you..
@ЕвгенийБородкин-ы8э
@ЕвгенийБородкин-ы8э Жыл бұрын
The best! Thanks! Please make more Typescript+Vue3(script setup)
@ProgramWithErik
@ProgramWithErik Жыл бұрын
Ok!
@revolutionoftheresolution5867
@revolutionoftheresolution5867 2 жыл бұрын
can you give us some info about how to use script setup on Vue3 - apollo? please do a video on this topic
@djdeuce00
@djdeuce00 2 жыл бұрын
Great video. You covered a lot and explained very well. I'm coming from React and this seems like the best way for me
@bhumit070
@bhumit070 3 жыл бұрын
thanks Erik for this video I will use this in my next project and I like this approach too much
@cryodream
@cryodream 3 жыл бұрын
4:38 What extension is putting those "hints" checkboxes above the the `` ❓ i.e.: setup sugar | ref sugar (take 2) 🤩
@Dazaer
@Dazaer 3 жыл бұрын
I would also like to know... vetur doesn't seem to do the trick for me EDIT: just found out it's volar
@mweb7344
@mweb7344 3 жыл бұрын
damn vue is improving so fast
@ProgramWithErik
@ProgramWithErik 3 жыл бұрын
Yeah things are moving fast!
@GaryLee
@GaryLee 3 жыл бұрын
Great tutorial for the setup function feature.
@ProgramWithErik
@ProgramWithErik 3 жыл бұрын
Glad it was helpful!
@NikolayErmolenko
@NikolayErmolenko 3 жыл бұрын
Hi, Erik. Can you describe next case: Vue3 + typescript + script setup + JSX ? Thx.
@RenatoFontes
@RenatoFontes 3 жыл бұрын
Thanks! The setup scripts looks awesome :)
@toddmoody9507
@toddmoody9507 3 жыл бұрын
Awesome overview! 🙌
@AndrewRusinas
@AndrewRusinas 2 жыл бұрын
I love the syntax, but I got so many error while I use it with TS (unused variables, error while importing Vue component, etc). Also, in my opinion, we should have a clear way to declare which variables will be accessible in template, which was previously achieved in setup() via return {}.
@mohammadaliafrasiaby2347
@mohammadaliafrasiaby2347 2 жыл бұрын
HELLOOOOOOOOOO! please create jwt authentication course in nuxt 3 and pinia THANK YOU !
@kirayamato6128
@kirayamato6128 2 жыл бұрын
Hey erik. What vscode extension do you use for vue?
@gaetanwichlacz8319
@gaetanwichlacz8319 2 жыл бұрын
Just discovered your channel. Massive props (pun intended) to you for these clear explanations. Used to Vue2 component Class Style, and now, for next projects, I might give a shot to this script setup thing. Awesome also how you cover every aspect. Props, events ...
@stevepottz111
@stevepottz111 3 жыл бұрын
Great Video! I really enjoyed it!
@tririfandani1876
@tririfandani1876 2 жыл бұрын
Nice info 😉 thanks
@swastikagarwal8605
@swastikagarwal8605 2 жыл бұрын
Hey Erik great tutorial, small question how do you send arrays as props in the same way I seem to get errors that the props are only readOnly when I try to set a default array of [" "]
@thomasbritton86
@thomasbritton86 3 жыл бұрын
On the face this is just pretty much the same as how to work with Svelte?
@arjunaravind1351
@arjunaravind1351 3 жыл бұрын
Hi Erik, How do we define lifecycle callback functions inside the API? Is it even possible?
@ProgramWithErik
@ProgramWithErik 3 жыл бұрын
Yup, you just import them in from "vue". Like import "onMounted" from "vue"
@contractorwolf
@contractorwolf 2 жыл бұрын
yeah, they just start with "on" (onMounted, etc. inside the setup) and there is no "created" because that is essentially the setup which only gets run the one time
@MarkoPetejan
@MarkoPetejan 3 жыл бұрын
I like the new way, would like to know more
@SergeiZahharenko
@SergeiZahharenko 3 жыл бұрын
cool stuff :) 2 bad I don't use VUE that often this days... looks nice
@robertoaddario861
@robertoaddario861 3 жыл бұрын
Thanks for the explanation
@ProgramWithErik
@ProgramWithErik 3 жыл бұрын
You're welcome
@azs06
@azs06 3 жыл бұрын
Excellent way to teach about the new features, It helps to understand the advantages/disadvantages of composition api when its showcased alongside options api. One thing I like a lot about Vue, is how adaptive they are when it comes to new features. Seems like these new features are inspired by Svelte and that's a good thing in my opinion.
@ryannorooz
@ryannorooz 3 жыл бұрын
just in time... last week i moved back from nuxt2 to vue3 to use the composition api it's really a better way to make SFCs hope nuxt catches up with the new changes
@dayumnson9769
@dayumnson9769 3 жыл бұрын
you can use nuxt compositionnapi package with nuxt2
@ryannorooz
@ryannorooz 3 жыл бұрын
@@dayumnson9769 yeah that has been around for awhile but it won't give you the full flexibility of vue3 a lot of features aren't there yet for nuxt
@PureAlbania
@PureAlbania 2 жыл бұрын
How to put the browser hidden on the right like that? Thank you!
@RianY2K
@RianY2K 3 жыл бұрын
This Vue JS is more comfortable to use with Composition API and new setup script
@icarofreitas6523
@icarofreitas6523 2 жыл бұрын
Thanks
@OzoneGrif
@OzoneGrif 3 жыл бұрын
Super interesting. We're using class components with Vue 2 in our project; but this new syntax feels a nice improvement. This is a lots of work to switch our project, tho.
@contractorwolf
@contractorwolf 2 жыл бұрын
we just started using this and you can do it at the component level (as long as the project is on vue 3). Just try it with new components you are writing and save the conversions of older code for later. They work together without issues.
@albinopepegas8391
@albinopepegas8391 2 жыл бұрын
what's your vscode font?
@likewealwaysdo
@likewealwaysdo 3 жыл бұрын
Oo putting the tag BEFORE the ? Somebody has been trying out Svelte I see 👀
@wobsoriano
@wobsoriano 3 жыл бұрын
It's now the default when creating a vue app with vite
@likewealwaysdo
@likewealwaysdo 3 жыл бұрын
@@wobsoriano ah i see my bad didnt realise since i dont rlly use vite 😅
@wobsoriano
@wobsoriano 3 жыл бұрын
@@likewealwaysdo yeah RIP vue-cli. Vite is fookin fast
@JenuelDevTutors
@JenuelDevTutors 3 жыл бұрын
ill definitely like this feature
@JarvisCodes
@JarvisCodes 3 жыл бұрын
Helpful Vid Subscribed!
@terenceflowers9159
@terenceflowers9159 3 жыл бұрын
Really nice!!!! Thanks!!!!
@babatundeojerinde
@babatundeojerinde 2 жыл бұрын
I think I prefer this approach… the options API requires too many boilerplate codes… with this, I can reduce the amount of code I write…
@adekivet
@adekivet 3 жыл бұрын
Hi Erik, nice video again! Just yesterday I used a different approach on your withDefault solution, with the same result: const props = defineProps({ direction: { type: String as PropType, default: 'row', } }) Do you have an opinion on which is the better approach? I am now leaning towards the the way you showed, although you have to wrap it in the 'withDefaults'. Maybe yours is better as you are able to define the type/interface separately when they become more complex? And it is more the generic TypeScript way vs specific Vue way? Just curious about your idea on this.
@edisonarango
@edisonarango 3 жыл бұрын
Yeah, your way is as in Vue 2, but the new approach allows you to define the props using Typescript so that you can get type inference in your editor.
@dayumnson9769
@dayumnson9769 3 жыл бұрын
the svelte way of doing vue, not bad.
@artphakphoom1012
@artphakphoom1012 3 жыл бұрын
NIce Video can i ask some question i struggle in the choosing framework to master it i use vue2 for a couple of my freelance and loving so much but i concern about vue3 for production it's a lot of arguing for now and react community is very big so that's make me struggle in choosing which one should i use i love both and i can't make desicion around 1 month already can someone make me clear my mind plz and sorry for my english.
@EugeneBuvard
@EugeneBuvard 2 жыл бұрын
I think I still like better the option API, it makes things clearer and forces a bit of order in js.
@gabe.henrique
@gabe.henrique 3 жыл бұрын
What lint / auto-complete plugin are you using? Vuteur doesn't have support yet & these errors are super distracting!
@ProgramWithErik
@ProgramWithErik 3 жыл бұрын
Use volar!
@gabe.henrique
@gabe.henrique 3 жыл бұрын
@@ProgramWithErik Awesome! Thanks dude
@pedrop1192
@pedrop1192 2 жыл бұрын
I was trying to translate a project I had to script setup, and I always get a 'defineEmits' is not defined errror. Same with 'defineProps'. Any idea of what might be going on?
@edu.paixao
@edu.paixao 3 жыл бұрын
Thanks!!
@George-ew2in
@George-ew2in 2 жыл бұрын
Hey Erik, very nice, but my Vetur extension has problem with setup script and if I define some variable or import component, Vetur says "something" is declared but its value is never read, it is possible to do something with it? anybody some tip? thank you for answer.
@ProgramWithErik
@ProgramWithErik 2 жыл бұрын
Try out Volar!
@chizuru1999
@chizuru1999 3 жыл бұрын
Hey i have 2 questions. 1. Whats your vscode font and theme. 2. I just build an app on Vue 3 and deployed it today. But I had to modularize it. Coming from Angular I don't like how we write 3 languages code in a single file and also no intellisense. So had to separate the files. Is there any official workaround or modularized architecture for large scale applications?.
@ProgramWithErik
@ProgramWithErik 3 жыл бұрын
I'm using Fira font and Synthwave 84. For intellesense make sure you're using either Vetur or Volar. I prefer Volar with Vue 3 and TypeScript. It works great. For large apps, you usually create Feature folders and put your components in there. You should stick with single file components. It makes the most sense. Take a look at the VUe 2/3 Enterprise boilerplate for some more suggestions on how to create larger Vue projects
@dev-am1303
@dev-am1303 3 жыл бұрын
Thanks Erik
@zhiweithean800
@zhiweithean800 2 жыл бұрын
I think defineEmits() does not state the events that the component will receive from the parent component, but what are the events this child component will emit up to its parent component. Just a mistake in the video explanation.
@ProgramWithErik
@ProgramWithErik 2 жыл бұрын
Aww thanks!
@nove1398
@nove1398 3 жыл бұрын
good one
@RodrigoCFD
@RodrigoCFD 2 жыл бұрын
21:30 Having two script blocks is really messed up... I like the idea of the Composition API, but stuff like that (and the damned .value everywhere) really shows how unpolished it is, like it was rushed.
@youjean83
@youjean83 3 жыл бұрын
theres just one thing that bothers me with the composition api. it exposes everything into the template while the optionsApi gives some more granular controll. i think it pretty much depends on the use case, preferences and how consistent you wanna be across the app..
@wota_pov
@wota_pov 3 жыл бұрын
Is there any fast way to migrate from composition api to this script setup?
@wobsoriano
@wobsoriano 3 жыл бұрын
is still composition API. Use Volar extension in vs code. It will add a checkbox above the script tag to toggle setup sugar.
@wota_pov
@wota_pov 3 жыл бұрын
@@wobsoriano Great! It's awesome
@andristefanus
@andristefanus 2 жыл бұрын
how do you invoke child's handler=false from parent's @click?
@cenancivi3407
@cenancivi3407 3 жыл бұрын
Thanks Erik, another very helpful video but I am afraid all these features are just adding excess on top of the simplicity and beauty of good old Vue2 with little and sometimes no extra functionality in most aspects. I am a novice developer but my view is that just as in business, the competitive edge of Vue was its simplicity and fast learning curve over others.
@ProgramWithErik
@ProgramWithErik 3 жыл бұрын
Yeah, I really like it, but it's not for everyone
@LucTemetNosce
@LucTemetNosce 3 жыл бұрын
The good thing is that you can still use it the way you are comfortable with, it's perfectly valid. This is just another way for those who want to do it in a new way.
@AdroSlice
@AdroSlice 2 жыл бұрын
The options API is a big reason we chose vue to begin with. However, we have now run into a situation where composition API stuff like provide/inject as well as composables may come in handy.
@arcooke
@arcooke 2 жыл бұрын
Glad to see this comment, I thought the same thing. Learning curve is much higher using the new style, though I can see the appeal of the new features. Not a huge fan of the way the "withDefaults" concept was implemented. Defaults are such a basic, common thing.. seems like there should be a more straightforward way to do this.
@antifa_communist
@antifa_communist Жыл бұрын
​@@arcooke No? Script Setup is way easier. To have a simple counter you need one line of JS (not including import). It's just like normal JS. Can someone explain how it's easier? And I get some people might prefer one over the other but the learning curve is basically non existent.
@ricko13
@ricko13 3 жыл бұрын
finally 👍
@tanzimibthesam5861
@tanzimibthesam5861 3 жыл бұрын
Top level async await is awesome
@ProgramWithErik
@ProgramWithErik 3 жыл бұрын
Yeah it is
@fardolieri
@fardolieri 3 жыл бұрын
I really don't understand that part. You didn't show a TOP LEVEL await in your example. You just defined an async function, that you called on button click. The interesting part would be to know if you can use an await in the 'setup' part i.e. on the top level, without using an 'onMounted'
@okq550
@okq550 2 жыл бұрын
I believe options API are well structured than this new SFC approach.
@ofuzak
@ofuzak 2 жыл бұрын
It doesn't log error on chrome console, verryyy had to debug
@heyyy4987
@heyyy4987 3 жыл бұрын
Awesome
@cwinter90
@cwinter90 3 жыл бұрын
This reminds me A LOT of Svlete... 😆
@rsixel
@rsixel 2 жыл бұрын
Killer!
@Mr_bombastic-839
@Mr_bombastic-839 2 жыл бұрын
very sorry at the begining itself, am here to learn Vue, and yes this is an amazing video, no doubt in that, but i couldn't help but notice the intro music you used, which constantly reminded me as if i was watching @Veritasium video, mostly to do with science and Physics... and that effected positively how i precieved this video, more like a fact based implementation than a tutorial.. anyway, just my opinion...
@georgemendle5587
@georgemendle5587 2 жыл бұрын
👋
@tihssiefil
@tihssiefil 3 жыл бұрын
受益匪浅
@jamols09
@jamols09 3 жыл бұрын
Shouldn't be the title: SFC defineEmits Tutorial ? hehe :)
@MrGokuuuuuu
@MrGokuuuuuu 2 жыл бұрын
This is so super confusing, that I have to watch this 25min video to even understand whats going on after encountering setup. If I see props they are props, if i see data that are data, i see methots well methods are in there, when i see mounted method I know to put stuff in there on start. But when I see "Setup" its some super confusing all in mixed stuff in shorthand syntax which make it even more confusing. I love vue from vue1-3 since of simplicity, one can see what is happening on first look, this setup is some Black magic.
@rajikkali2381
@rajikkali2381 3 жыл бұрын
Too. Much. Boilerplate. Besides TS support, this is just way too much typing for things you'll be doing all the time. I've built many medium to large-scale apps, and this looks horribly ugly to me compared to the Options API. I keep wanting to like the composition API / Setup.... but alas I just can't.
@sibyl4861
@sibyl4861 3 жыл бұрын
You have to write more stuff with options API tho
@rajikkali2381
@rajikkali2381 3 жыл бұрын
@@sibyl4861 I don’t feel that way , especially when I use snippets to generate code
@AndiRadyKurniawan
@AndiRadyKurniawan 3 жыл бұрын
This is basically svelte. 😅
@kirayamato6128
@kirayamato6128 2 жыл бұрын
I really don't understand at all. Why there must be an options to choose. This makes developer really confused. What should i choose? Setup function or the ? LOL. That's why sometimes i hate vue. Inconsistent framework
@emmazn5192
@emmazn5192 3 жыл бұрын
am i the only to find that the script setup is less understandable than classic script ? like there is no more structure between data, computed, watchers...
@nested9301
@nested9301 Жыл бұрын
this is the way it's should be all the time smh
@davidzita1404
@davidzita1404 3 жыл бұрын
typescript 🤮🤮🤮🤮
@wobsoriano
@wobsoriano 3 жыл бұрын
found the TS hater! hehe it's okay to hate it. To each their own
Every New Vue Developer Has Made These Mistakes...
18:04
Program With Erik
Рет қаралды 45 М.
Vue 3: Reactivity Made Easy (ref, reactive, toRefs... oh my!)
13:04
Program With Erik
Рет қаралды 49 М.
1, 2, 3, 4, 5, 6, 7, 8, 9 🙈⚽️
00:46
Celine Dept
Рет қаралды 109 МЛН
World’s strongest WOMAN vs regular GIRLS
00:56
A4
Рет қаралды 49 МЛН
Real Man relocate to Remote Controlled Car 👨🏻➡️🚙🕹️ #builderc
00:24
Disrespect or Respect 💔❤️
00:27
Thiago Productions
Рет қаралды 42 МЛН
Vue 3 Script Setup Tutorial - This Changes Everything!
23:40
Make Apps with Danny
Рет қаралды 62 М.
Vue.js Tips: Use Slots The Right Way // VUE.JS SLOTS TUTORIAL WITH VUE 3
11:59
Vue State Management Pinia Crash Course - Pinia Tutorial Vue.js 3
15:42
Program With Erik
Рет қаралды 49 М.
Vue 3 Composition API Introduction [FULL TUTORIAL]
23:46
Academind
Рет қаралды 176 М.
Vue 3 & Composition API - Full Project
1:09:15
Traversy Media
Рет қаралды 147 М.
3 Must Know Tips For Nuxt.js Developers
9:23
Program With Erik
Рет қаралды 10 М.
Proven Pinia Patterns - VueConf US 2023
31:34
Vue Mastery
Рет қаралды 15 М.
Why Use Nuxt JS 3 Beta?! (Vue.js 3 With Nuxt Tutorial!!)
32:33
Program With Erik
Рет қаралды 58 М.
1, 2, 3, 4, 5, 6, 7, 8, 9 🙈⚽️
00:46
Celine Dept
Рет қаралды 109 МЛН