Pinia Simplified

  Рет қаралды 121,572

LearnVue

LearnVue

Күн бұрын

With Pinia being the new recommended data store solution for Vue, here are some of the essentials you need to know about it!
LINKS
pinia.vuejs.org/
✅ FREE VUE 3 CHEATSHEET WITH ESSENTIAL CODE SNIPPETS
learnvue.co/vu...
follow me on twitter:
/ mattmaribojoc
🚨 Like quick Vue lessons like these? Check out 800+ lessons over on Vue School - go.learnvue.co...
Music by Lukrembo

Пікірлер: 136
@Tommy-and-Ray
@Tommy-and-Ray 2 жыл бұрын
this guy deserves a lot more credit for these videos, really well presented quality content
@itskittyme
@itskittyme Жыл бұрын
who are you calling out for not giving enough credit? you are confusing me :-(
@niner8275
@niner8275 Жыл бұрын
@@itskittyme probably me. 😞 So I will give more credit: It's not only well presented quality content, it's also very bloat- and noise-free, it gets so to the point very quickly, it's like tutorial.zip. Or better, tutorial.7z.
@alexgunt8065
@alexgunt8065 Жыл бұрын
Best course design! No typing, just inserted whole words!
@isimvol
@isimvol 2 жыл бұрын
The main problem Redux solved is not creating shakable/splittable global state, but to make it predictable. It looks like Pinia will lead to more spaghetti code with various components updating various stores.
@ricko13
@ricko13 2 жыл бұрын
I clicked on the video thinking, please don't make the typical _counter_ example
@nuqtamedia1294
@nuqtamedia1294 2 жыл бұрын
I have never learned this much in such a short time. Thank you so much!!!
@Blazeking636
@Blazeking636 2 жыл бұрын
Thank you for sharing the destructing issue. I'm using Pinia in my current project and didn't notice that was the issue with some of the bugs I've seen. Great intro video :D
@cindrmon
@cindrmon 2 жыл бұрын
thanks for the tutorial! makes me wrap my head around pinia even more, as i have grown to get used to vuex.
@LearnVue
@LearnVue 2 жыл бұрын
Glad to hear that!
@happynewyearw
@happynewyearw 2 жыл бұрын
would love to see example of using function syntax of pinia instead of object syntax
@LearnVue
@LearnVue 2 жыл бұрын
there's definitely more pinia videos coming soon!
@jftalarico
@jftalarico 2 жыл бұрын
I'd like to see a comparison or justification for using Pinia vs just implementing a store with ref(), computed(), and ()=>{} functions. I recently stripped out vuex from a mid-sized app when I moved to the composition API and found the built-in reactivity features much easier to deal with. No mental mapping of getters, etc. and it's easy to break up code into any arbitrary modules. "Getters" are just computed values on the store. "Actions" are just arrow functions that manipulate the store...or perform any other operations like hitting an API and conditionally modifying the store. specific getters and actions can be imported where they're needed. But again, the best part (for me) is that the store uses the same code patterns used everywhere else in the code base.
@jftalarico
@jftalarico 2 жыл бұрын
HA! nevermind. I just found the video on Vue State Management WITHOUT Vuex. :)
@milos018
@milos018 2 жыл бұрын
Great work, man. Short but to the point! Keep it up.
@LearnVue
@LearnVue 2 жыл бұрын
aye thank you!
@samuelslivos4054
@samuelslivos4054 Жыл бұрын
All important informations summarized in this video, really good work!
@B1GTM4N
@B1GTM4N 2 жыл бұрын
This content is very informative, well-written, and succinct! Keep up the amazing work!
@LearnVue
@LearnVue 2 жыл бұрын
Appreciate it a ton - I will :)
@LovelyAndyy
@LovelyAndyy 2 жыл бұрын
Great little introduction! When already working with Typescript in an app, do you think there really is a need for Vuex or Pinia over using just the composition API with refs? Are the devtools and Hot module replacement the only real upside of Pinia?
@LearnVue
@LearnVue 2 жыл бұрын
in addition to the better typescript support mentioned, there's also some security issues regarding SSR and just exposing a reactive object in your app. the Pinia docs do a great job explaining the benefits of Pinia over the Composition API pinia.vuejs.org/introduction.html#why-should-i-use-pinia
@soviut303
@soviut303 2 жыл бұрын
You _can_ make a module behave as a global store by putting reactive values into it and importing it all over your app. However, this tightly couples this module to everything, making it very difficult to mock and test things in isolation. The next logical step would be to turn your module into a provider/inject pattern (eg: useStore) for better isolation and testability, but if you're doing that you might as well just use Pinya at that point since it already works that way and has its own docs, is well tested, devtools support, HMR and SSR support, etc.
@andykarwoski761
@andykarwoski761 2 жыл бұрын
@@soviut303 awesome! Thanks for that breakdown!
@JETLAI123
@JETLAI123 2 жыл бұрын
I use the pure composition API with refs and provide/inject, everything works great and is clean.
@soviut303
@soviut303 2 жыл бұрын
@@JETLAI123 It definitely works but Pinya is doing the same thing and is fully documented and fully tested (plus HMR, SSR and Devtools support). Rolling your own solution is fine if you're the only one who has to maintain the code, but it will just wind up being more technical debt to maintain if you're on a team.
@davidbeljan
@davidbeljan 2 жыл бұрын
Nice intro and very well presented! Glad that I'm not the only one still watching King Of Queens :)
@Al-Misanthropic-Bundy
@Al-Misanthropic-Bundy 2 жыл бұрын
Finally a Pinia tutorial not in typescript!
@danielegvi
@danielegvi 2 жыл бұрын
Your code will be the same whether you use TS or JS.
@ChristopherFranko
@ChristopherFranko 2 жыл бұрын
@@danielegvi I agree so why use TS :D
@danielegvi
@danielegvi 2 жыл бұрын
@@ChristopherFranko So that the programmer who uses _your_ code won’t be lost
@ChristopherFranko
@ChristopherFranko 2 жыл бұрын
@@danielegvi I get it, I just loathe ts lol Feels like so much extra for so little return but I think its just because I havnt forced myself to stick with it and I generally work with like 1-5 people at max. And we document tf out of everything.
@guillermomazzari4983
@guillermomazzari4983 2 жыл бұрын
Since you asked, I would love to see a full-stack app using Vue3 + Pinia + Tailwind + Firebase :D
@zeppelin0110
@zeppelin0110 2 жыл бұрын
GREAT tutorial. Super straightforward. Thank you.
@abdillahsyafiq
@abdillahsyafiq Жыл бұрын
your explanation is very clear, thank you
@zzing
@zzing 2 жыл бұрын
Why would you make a function async but not use await anywhere? Wouldn’t it be the same as if you didn’t put async there? I would have thought returning a promise and using set timeout to resolve that would make sense.
@zzing
@zzing 2 жыл бұрын
Not sure why you are saying this, my point was that using the async keyword is pointless in this case.
@torazis3286
@torazis3286 3 ай бұрын
"This was Pinia in one hundred seconds, thanks for watching and I'll see you in the next one."
@dennissam1387
@dennissam1387 2 жыл бұрын
It will be great if you make a tutorial on using node shims in vitejs like global,buffer, process....
@baka_baca
@baka_baca 2 жыл бұрын
Have not been a fan of Vuex for a while, seen it get just as messy as Redux in the wild. In that Pinia seems to be a step towards Svelte-like stores (still more complicated though) I'd be curious to check it out.
@notkamui9749
@notkamui9749 Жыл бұрын
you can define the store seen in the video like this export const useCounterStore = defineStore("counter", () => { const count = ref(0) const doubleCount = computed(() => count * 2) function increment(val = 1) { count.value += val } async function waitAndAdd() { setTimeout(() => count.value++, 2000) } return { count, doubleCount, increment, waitAndAdd } }) it really is just a setup function, like in a component
@flaviusneagos597
@flaviusneagos597 2 жыл бұрын
thanks for the info really helped alot. i rather learn about tNice tutorials than school
@rafaelsaboia910
@rafaelsaboia910 2 жыл бұрын
the best video that I seen congratulations....
@LearnVue
@LearnVue 2 жыл бұрын
Thank you thank you :)
@njitaarnaud
@njitaarnaud 2 жыл бұрын
Thanks for this. Please can you create a video on how to consume APIs and make POST requests using the Pinia store with the Axios package ??
@VictorZamanian
@VictorZamanian 2 жыл бұрын
Sure wish tutorials like this would use TypeScript.
@krtirtho
@krtirtho 2 жыл бұрын
It's like zustand for vue. Great tool
@jit-r5b
@jit-r5b 7 ай бұрын
I'm so confused why setTimeout in async function is awaited without any nested promise resolve etc. If someone can explain, I'd love that. But my best guess is that it actually doesn't need "async" keyword as it doesn't do anything other than delay mutation upon timeout resolves.
@FelipeMSV
@FelipeMSV 2 жыл бұрын
Wowww is a nice alternative to Vuex, but i think is very similar than vuex and now on Vue3 we have native way to share data between components and make persistent data with provide/inject
@ChristopherFranko
@ChristopherFranko 2 жыл бұрын
Yea id deff say that you dont always need this, and you could build persistent apps that didnt, but in cases that you dont want to use inject/provide pinia is a solid and imo easy to understand state management solution. Especially as explained in this video.
@anorebel1816
@anorebel1816 2 жыл бұрын
Awesome content.. I've recently switched from Vuex to Pinia, so far so good.. Can I request for a Vue-Query video??
@shakhbozkhudoyberdiev3661
@shakhbozkhudoyberdiev3661 2 жыл бұрын
decided to try it out.
@jaqb_007
@jaqb_007 Жыл бұрын
Good examples 👍
@Wreighn
@Wreighn 8 ай бұрын
So, it's similar to vuex, but you have to mess with imports instead of just doing $store.
@mimachakata
@mimachakata 4 ай бұрын
Can you do a tutorial using setup / composition api in pinia Edit: Thanks 🙏🏾
@matanon8454
@matanon8454 10 ай бұрын
Love your videos! ❤
@khaledoghli3400
@khaledoghli3400 Жыл бұрын
Thanks ,how we delete a store from pinia developer tools when routing to another page .
@caiovinicius7871
@caiovinicius7871 2 жыл бұрын
Awesome video, nice work! Can you make a video or article explaining in which situations we should use state management (like Pinia)? Actually I fell very confused when use those things, always using only ref and reactive for a 'little' system management.
2 жыл бұрын
That would be good ! It is hard to find material about good practices on this topic.
@Jorgeee
@Jorgeee 2 жыл бұрын
Pinia is basically when you need global variables between route changes. You most likely won't need it for a site with just a single page
@svenyboyyt2304
@svenyboyyt2304 Жыл бұрын
You just answered your own question. If you can use ref and reactive, then why the hell would you use a store? Stores work across the entire website, not just the current component.
@caiovinicius7871
@caiovinicius7871 Жыл бұрын
@@svenyboyyt2304 it's not about use reactive or store (pinia, vuex) for an system management, it's about WHEN.
@iedi3
@iedi3 Жыл бұрын
as far as I remember from Vuex, the states shouldn’t be changed directly, like store.count++. Am I wrong?
@mackenro1512
@mackenro1512 2 жыл бұрын
GR8 IDEA TYTY
@sanusivictorolajuwon514
@sanusivictorolajuwon514 2 жыл бұрын
Great tutorial as always. Thanks now and always😁
@LearnVue
@LearnVue 2 жыл бұрын
youre welcome! glad you like it
@Nomunkh69
@Nomunkh69 2 жыл бұрын
Nice tutorial brother i just want to ask you wNice tutorialch software is easy and best to learn as DAW soft soft or abelton live. Pls reply as soon as you can
@pstoa
@pstoa 2 жыл бұрын
The quality of videos is second to none (not only in the Vue space)!
@LearnVue
@LearnVue 2 жыл бұрын
appreciate that a ton!
@borisrosedeveloppeurweb
@borisrosedeveloppeurweb 2 жыл бұрын
I have a problem I did most of that and state remains undefined , my Object is very very deep in the structure of the state , why ?
@vistauz
@vistauz 2 жыл бұрын
What font you use in the video. It is awesome. It is at 0:04 time.
@minhquang7610
@minhquang7610 2 жыл бұрын
Thank your for the great video!!
@kevinvishal9071
@kevinvishal9071 2 жыл бұрын
Thank you so much for this... So Pinia = Vuex + Simplicity 😁😁😁
@mentalites
@mentalites 2 жыл бұрын
Thanks Brother
@alherrera9390
@alherrera9390 2 жыл бұрын
Seems to me like just a wrapper to make data models for Vue 3 to be very similar to Vue 2 regarding to syntax
@rz7510
@rz7510 2 жыл бұрын
awesome, great tutorial !!!
@marianofpv
@marianofpv Жыл бұрын
Serenity now!
@roboticol6280
@roboticol6280 2 жыл бұрын
Your editing reminds me of fireship
@tech6841
@tech6841 2 жыл бұрын
hi great video tho!! do you know if in large projects should i have a module folder structure similar to vuex modules but those module folders inside in the stores root folder from pinia ?? i think it could be a lot of files inside just one folder in large projects at least thanks ! :D
@saptarshisengupta5073
@saptarshisengupta5073 2 жыл бұрын
So it's react query for vue?
@ricardocastanho4717
@ricardocastanho4717 2 жыл бұрын
Nice video!
@clemensb7123
@clemensb7123 2 жыл бұрын
I use applepie instead of pinia
@barbieroalex
@barbieroalex 2 жыл бұрын
I need some help, I'm starting a new nuxt 3 project should I use pinia over the nuxt useState?
@ahmadal-noufi4331
@ahmadal-noufi4331 2 жыл бұрын
You should be my maths teacher
@burloiumarian2665
@burloiumarian2665 Жыл бұрын
I dont really get how or why the store values are not reactive ... you mean if you mutate any state value that will not be reactive when you want to see it inside the component??? That is just awful if so ...
@jntaca
@jntaca 2 жыл бұрын
Great !! Thanks !
@ayasharamadhan4441
@ayasharamadhan4441 2 жыл бұрын
You did well man, thx you
@LearnVue
@LearnVue 2 жыл бұрын
thanks!
@upsylondeveloppement8837
@upsylondeveloppement8837 2 жыл бұрын
very helpfull thanks !
@marvenwilsonsdonque1568
@marvenwilsonsdonque1568 2 жыл бұрын
wait you guys use store?
@waelgh4307
@waelgh4307 8 ай бұрын
Greate, thanks
@mahdimousavi3470
@mahdimousavi3470 2 жыл бұрын
perfect
@timkilian7140
@timkilian7140 2 жыл бұрын
Don't know. I still like vuex more. There could be some better typescript ide support tho.
@rifki0011
@rifki0011 2 жыл бұрын
Hi, great work! idk if this is a stupid question but I wonder why we use data store like pinia when we can set reactive var on composition file globally with ref
@fueledbycoffee583
@fueledbycoffee583 2 жыл бұрын
Ok so i have never used neither vuex or pinia. But I am getting into using one because the advantages i think are first: Changes trace: You can see what is changing inside ur app and how is changing without using console.logs. Other thing is a clean and centralized way to organize your global data so is not cumbersome to access or import. Is all about keeping it standard and tracesable
@rifki0011
@rifki0011 2 жыл бұрын
@@fueledbycoffee583ah okay, that one make sense
@luisrogelio98
@luisrogelio98 2 жыл бұрын
It is to have standard and organization of the data flow, and be able to make tests of isolates parts of the app, and setting global in one file wont give you benefits like , the data flow of actions, state, getter, mutations (if vuex) , and to have all organized in my job the main project has 20 vuex submodules and in each modules the action file alone is 600 lines each, having that in ref with composition will be spaghetti code imposible to debug.
@AndreasBeder
@AndreasBeder 2 жыл бұрын
I will give pinia a try, any good resource for keeping the state in sync across multiple tabs / devices?
@LearnVue
@LearnVue 2 жыл бұрын
storing it in localStorage for multiple tabs/sessions or in a DB for storage across devices!
@hanzladev
@hanzladev 2 жыл бұрын
How to create videos like you create?
@RodrigoDAgostino
@RodrigoDAgostino 2 жыл бұрын
Yes, finally! :D
@LearnVue
@LearnVue 2 жыл бұрын
haha i listen to everyone's comments! pinia is awesome
@RodrigoDAgostino
@RodrigoDAgostino 2 жыл бұрын
@@LearnVue there’s no doubt about both of those things :)
@dragon3602010
@dragon3602010 2 жыл бұрын
Can we use it with Nuxtjs or Quasar? Thanks
@LearnVue
@LearnVue 2 жыл бұрын
yup! here's some info from the docs: pinia.vuejs.org/ssr/nuxt.html
@DanielTames
@DanielTames 2 жыл бұрын
awesome❤❤
@GGdevelopment
@GGdevelopment 2 жыл бұрын
Who are the creators of pania?
@ericjunior105
@ericjunior105 2 жыл бұрын
Let's Gooooooooo
@user-dz7ez2hn9z
@user-dz7ez2hn9z 2 жыл бұрын
if only you could provide start-up files
@DoDMayor
@DoDMayor 2 жыл бұрын
Szeretem a PINiÁT
@butterfly7562
@butterfly7562 2 жыл бұрын
seems like zustand
@SquareIsNotCool
@SquareIsNotCool 2 жыл бұрын
What IDE theme is that? It looks awesome
@thecoolnewsguy
@thecoolnewsguy Жыл бұрын
Dracula 🧛‍♂️
@SquareIsNotCool
@SquareIsNotCool Жыл бұрын
@@thecoolnewsguy Thanks bestie
@kwesikwaa
@kwesikwaa 2 жыл бұрын
great video
@LearnVue
@LearnVue 2 жыл бұрын
thanks!
@Lucas-mu5no
@Lucas-mu5no 2 жыл бұрын
Nice video.
@LearnVue
@LearnVue 2 жыл бұрын
thanks for watching
@zhonghuawang4155
@zhonghuawang4155 2 жыл бұрын
Why do we need those kind of things? adding these kinds of extra logic that just means the design has some problems.
@riyad-appscode
@riyad-appscode 2 жыл бұрын
❤‍🔥❤‍🔥❤‍🔥❤‍🔥
@trplnr
@trplnr 2 жыл бұрын
I noticed something, your editing and intro is similar to fireships
@SuperRoqsta
@SuperRoqsta 2 жыл бұрын
You know all i want to tell man)
@dmitriykret8938
@dmitriykret8938 2 жыл бұрын
👍
@dustinRo
@dustinRo 2 жыл бұрын
Nasty charge never said it did but ok
@moustaphagaye7978
@moustaphagaye7978 2 жыл бұрын
je suis un francais les gars car il y a la traduction en francais ceux qui sont francais mais qui ne comprend un tout petit peut la langue
@FrederickAlvarez_
@FrederickAlvarez_ 2 жыл бұрын
vite please 🥺
@LearnVue
@LearnVue 2 жыл бұрын
would you be interested in Vite specific to Vue? or just more general Vite tutorials
@FrederickAlvarez_
@FrederickAlvarez_ 2 жыл бұрын
@@LearnVue general vite and examples on how to do production grade deployments, how can you add vite to existing quasar projects etc
@Rundik
@Rundik 5 ай бұрын
This is not how you use async
@edrivenstudioslevar
@edrivenstudioslevar 2 жыл бұрын
The voiceover is so monotone. Good content tho.
@xushenxin
@xushenxin 2 жыл бұрын
I don't think the additional benefits of Pinia over Vuex warrants a new store solution. I would rather Pinia doesn't exist. A lot of things should not be invented.
@ColinRichardson
@ColinRichardson 2 жыл бұрын
Hmm, not a massive fan of `this` referring to 'state' in the actions.. That is just more of that black magic everyone loves to hate.
@dixienormis3614
@dixienormis3614 Жыл бұрын
You copied this tutorial from like 3 other videos, however yours does nothing to explain how to use it, you just quickly gloss over things you swiped from the other tutorials without going into any explanation
@CHUCh4N
@CHUCh4N 2 жыл бұрын
successful. TNice tutorials video has made tNice tutorials software SO simple to understand that I have full confidence I will be able to beco super efficient
Learn Pinia in 30 MINUTES! (Vue JS 3)
33:58
Make Apps with Danny
Рет қаралды 118 М.
The Difference Between Vue and React
10:27
Lachlan Miller
Рет қаралды 36 М.
Underwater Challenge 😱
00:37
Topper Guild
Рет қаралды 48 МЛН
Just Give me my Money!
00:18
GL Show Russian
Рет қаралды 1,1 МЛН
The Pinia Crash Course
34:40
Laith Academy
Рет қаралды 16 М.
What's the Difference Between Vue2 and Vue3?
20:29
Rob Conery
Рет қаралды 16 М.
Learn Vite with Evan You
13:35
Vue Mastery
Рет қаралды 264 М.
3 Ways to Persist Pinia State
4:54
LearnVue
Рет қаралды 53 М.
Vue 3: Reactivity Made Easy (ref, reactive, toRefs... oh my!)
13:04
Program With Erik
Рет қаралды 49 М.
Vue Slots Simplified
7:25
LearnVue
Рет қаралды 55 М.
You're Probably Using Nuxt Wrong
5:16
LearnVue
Рет қаралды 22 М.
Vue State Management Pinia Crash Course - Pinia Tutorial Vue.js 3
15:42
Program With Erik
Рет қаралды 49 М.