Pinia Simplified

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ต.ค. 2024
  • 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

ความคิดเห็น • 137

  • @Tommy-and-Ray
    @Tommy-and-Ray 2 ปีที่แล้ว +33

    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 ปีที่แล้ว +2

    Best course design! No typing, just inserted whole words!

  • @LovelyAndyy
    @LovelyAndyy 2 ปีที่แล้ว +36

    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 ปีที่แล้ว +7

      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 ปีที่แล้ว +6

      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 ปีที่แล้ว +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 ปีที่แล้ว +8

      @@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.

  • @Blazeking636
    @Blazeking636 2 ปีที่แล้ว +3

    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

  • @isimvol
    @isimvol 2 ปีที่แล้ว +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.

  • @nuqtamedia1294
    @nuqtamedia1294 2 ปีที่แล้ว +1

    I have never learned this much in such a short time. Thank you so much!!!

  • @cindrmon
    @cindrmon 2 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      Glad to hear that!

  • @jftalarico
    @jftalarico 2 ปีที่แล้ว +1

    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. :)

  • @samuelslivos4054
    @samuelslivos4054 ปีที่แล้ว

    All important informations summarized in this video, really good work!

  • @milos018
    @milos018 2 ปีที่แล้ว +4

    Great work, man. Short but to the point! Keep it up.

    • @LearnVue
      @LearnVue  2 ปีที่แล้ว

      aye thank you!

  • @B1GTM4N
    @B1GTM4N 2 ปีที่แล้ว +5

    This content is very informative, well-written, and succinct! Keep up the amazing work!

    • @LearnVue
      @LearnVue  2 ปีที่แล้ว

      Appreciate it a ton - I will :)

  • @happynewyearw
    @happynewyearw 2 ปีที่แล้ว +6

    would love to see example of using function syntax of pinia instead of object syntax

    • @LearnVue
      @LearnVue  2 ปีที่แล้ว +3

      there's definitely more pinia videos coming soon!

  • @ricko13
    @ricko13 2 ปีที่แล้ว +8

    I clicked on the video thinking, please don't make the typical _counter_ example

  • @davidbeljan
    @davidbeljan 2 ปีที่แล้ว

    Nice intro and very well presented! Glad that I'm not the only one still watching King Of Queens :)

  • @zeppelin0110
    @zeppelin0110 2 ปีที่แล้ว +1

    GREAT tutorial. Super straightforward. Thank you.

  • @baka_baca
    @baka_baca 2 ปีที่แล้ว +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 ปีที่แล้ว +1

      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

  • @zzing
    @zzing 2 ปีที่แล้ว +4

    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.

  • @Al-Misanthropic-Bundy
    @Al-Misanthropic-Bundy 2 ปีที่แล้ว +4

    Finally a Pinia tutorial not in typescript!

    • @danielegvi
      @danielegvi 2 ปีที่แล้ว +1

      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.

  • @torazis3286
    @torazis3286 4 หลายเดือนก่อน

    "This was Pinia in one hundred seconds, thanks for watching and I'll see you in the next one."

  • @abdillahsyafiq
    @abdillahsyafiq ปีที่แล้ว

    your explanation is very clear, thank you

  • @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??

  • @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 ??

  • @dennissam1387
    @dennissam1387 2 ปีที่แล้ว +1

    It will be great if you make a tutorial on using node shims in vitejs like global,buffer, process....

  • @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.

  • @krtirtho
    @krtirtho 2 ปีที่แล้ว

    It's like zustand for vue. Great tool

  • @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

  • @flaviusneagos597
    @flaviusneagos597 2 ปีที่แล้ว

    thanks for the info really helped alot. i rather learn about tNice tutorials than school

  • @guillermomazzari4983
    @guillermomazzari4983 2 ปีที่แล้ว

    Since you asked, I would love to see a full-stack app using Vue3 + Pinia + Tailwind + Firebase :D

    • @giddeo
      @giddeo 19 วันที่ผ่านมา

      I don't know if I'll ever be onboard with tailwind.

  • @caiovinicius7871
    @caiovinicius7871 2 ปีที่แล้ว +4

    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 ปีที่แล้ว +1

      That would be good ! It is hard to find material about good practices on this topic.

    • @Jorgeee
      @Jorgeee 2 ปีที่แล้ว +1

      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

    • @sven_527
      @sven_527 ปีที่แล้ว

      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 ปีที่แล้ว

      @@sven_527 it's not about use reactive or store (pinia, vuex) for an system management, it's about WHEN.

  • @rafaelsaboia910
    @rafaelsaboia910 2 ปีที่แล้ว

    the best video that I seen congratulations....

    • @LearnVue
      @LearnVue  2 ปีที่แล้ว

      Thank you thank you :)

  • @iedi3
    @iedi3 ปีที่แล้ว

    as far as I remember from Vuex, the states shouldn’t be changed directly, like store.count++. Am I wrong?

  • @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

  • @shakhbozkhudoyberdiev3661
    @shakhbozkhudoyberdiev3661 2 ปีที่แล้ว

    decided to try it out.

  • @jit-r5b
    @jit-r5b 8 หลายเดือนก่อน

    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.

  • @pstoa
    @pstoa 2 ปีที่แล้ว

    The quality of videos is second to none (not only in the Vue space)!

    • @LearnVue
      @LearnVue  2 ปีที่แล้ว

      appreciate that a ton!

  • @vistauz
    @vistauz 2 ปีที่แล้ว

    What font you use in the video. It is awesome. It is at 0:04 time.

  • @Wreighn
    @Wreighn 10 หลายเดือนก่อน

    So, it's similar to vuex, but you have to mess with imports instead of just doing $store.

  • @kevinvishal9071
    @kevinvishal9071 2 ปีที่แล้ว

    Thank you so much for this... So Pinia = Vuex + Simplicity 😁😁😁

  • @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!

  • @matanon8454
    @matanon8454 11 หลายเดือนก่อน

    Love your videos! ❤

  • @jaqb_007
    @jaqb_007 ปีที่แล้ว

    Good examples 👍

  • @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 ?

  • @barbieroalex
    @barbieroalex 2 ปีที่แล้ว

    I need some help, I'm starting a new nuxt 3 project should I use pinia over the nuxt useState?

  • @khaledoghli3400
    @khaledoghli3400 ปีที่แล้ว

    Thanks ,how we delete a store from pinia developer tools when routing to another page .

  • @mimachakata
    @mimachakata 5 หลายเดือนก่อน

    Can you do a tutorial using setup / composition api in pinia
    Edit: Thanks 🙏🏾

  • @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

  • @VictorZamanian
    @VictorZamanian 2 ปีที่แล้ว +3

    Sure wish tutorials like this would use TypeScript.

  • @mackenro1512
    @mackenro1512 2 ปีที่แล้ว

    GR8 IDEA TYTY

  • @minhquang7610
    @minhquang7610 2 ปีที่แล้ว

    Thank your for the great video!!

  • @marianofpv
    @marianofpv ปีที่แล้ว

    Serenity now!

  • @sanusivictorolajuwon514
    @sanusivictorolajuwon514 2 ปีที่แล้ว

    Great tutorial as always. Thanks now and always😁

    • @LearnVue
      @LearnVue  2 ปีที่แล้ว

      youre welcome! glad you like it

  • @SquareIsNotCool
    @SquareIsNotCool 2 ปีที่แล้ว

    What IDE theme is that? It looks awesome

  • @rz7510
    @rz7510 2 ปีที่แล้ว

    awesome, great tutorial !!!

  • @mentalites
    @mentalites 2 ปีที่แล้ว

    Thanks Brother

  • @dragon3602010
    @dragon3602010 2 ปีที่แล้ว +1

    Can we use it with Nuxtjs or Quasar? Thanks

    • @LearnVue
      @LearnVue  2 ปีที่แล้ว +2

      yup! here's some info from the docs: pinia.vuejs.org/ssr/nuxt.html

  • @rifki0011
    @rifki0011 2 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      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 ปีที่แล้ว +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.

  • @ayasharamadhan4441
    @ayasharamadhan4441 2 ปีที่แล้ว

    You did well man, thx you

  • @jntaca
    @jntaca 2 ปีที่แล้ว

    Great !!
    Thanks !

  • @marvenwilsonsdonque1568
    @marvenwilsonsdonque1568 2 ปีที่แล้ว

    wait you guys use store?

  • @upsylondeveloppement8837
    @upsylondeveloppement8837 2 ปีที่แล้ว

    very helpfull thanks !

  • @saptarshisengupta5073
    @saptarshisengupta5073 2 ปีที่แล้ว

    So it's react query for vue?

  • @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 ...

  • @ricardocastanho4717
    @ricardocastanho4717 2 ปีที่แล้ว

    Nice video!

  • @roboticol6280
    @roboticol6280 2 ปีที่แล้ว

    Your editing reminds me of fireship

  • @ahmadal-noufi4331
    @ahmadal-noufi4331 2 ปีที่แล้ว

    You should be my maths teacher

  • @timkilian7140
    @timkilian7140 2 ปีที่แล้ว

    Don't know. I still like vuex more. There could be some better typescript ide support tho.

  • @waelgh4307
    @waelgh4307 9 หลายเดือนก่อน

    Greate, thanks

  • @mahdimousavi3470
    @mahdimousavi3470 2 ปีที่แล้ว

    perfect

  • @hanzladev
    @hanzladev 2 ปีที่แล้ว

    How to create videos like you create?

  • @RodrigoDAgostino
    @RodrigoDAgostino 2 ปีที่แล้ว

    Yes, finally! :D

    • @LearnVue
      @LearnVue  2 ปีที่แล้ว +1

      haha i listen to everyone's comments! pinia is awesome

    • @RodrigoDAgostino
      @RodrigoDAgostino 2 ปีที่แล้ว

      @@LearnVue there’s no doubt about both of those things :)

  • @DanielTames
    @DanielTames 2 ปีที่แล้ว

    awesome❤❤

  • @GGdevelopment
    @GGdevelopment 2 ปีที่แล้ว

    Who are the creators of pania?

  • @dmitriykret8938
    @dmitriykret8938 2 ปีที่แล้ว

    👍

  • @riyad-appscode
    @riyad-appscode 2 ปีที่แล้ว

    ❤‍🔥❤‍🔥❤‍🔥❤‍🔥

  • @ericjunior105
    @ericjunior105 2 ปีที่แล้ว

    Let's Gooooooooo

  • @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.

  • @DoDMayor
    @DoDMayor 2 ปีที่แล้ว

    Szeretem a PINiÁT

  • @kwesikwaa
    @kwesikwaa 2 ปีที่แล้ว

    great video

  • @网于睿
    @网于睿 2 ปีที่แล้ว

    if only you could provide start-up files

  • @trplnr
    @trplnr 2 ปีที่แล้ว

    I noticed something, your editing and intro is similar to fireships

  • @clemensb7123
    @clemensb7123 2 ปีที่แล้ว

    I use applepie instead of pinia

  • @SuperRoqsta
    @SuperRoqsta 2 ปีที่แล้ว

    You know all i want to tell man)

  • @butterfly7562
    @butterfly7562 2 ปีที่แล้ว

    seems like zustand

  • @dustinRo
    @dustinRo 2 ปีที่แล้ว

    Nasty charge never said it did but ok

  • @Rundik
    @Rundik 6 หลายเดือนก่อน

    This is not how you use async

  • @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 ปีที่แล้ว +1

      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

  • @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