3 Ways to Persist Pinia State

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ต.ค. 2024
  • A common use case for all data stores is the need to persist data. In this video, we'll see a few different approaches to achieve this from coding it ourselves to using some of the Pinia plugins built by the Vue community.
    LINKS
    Last Pinia Video: • Create a Pinia Store w...
    github.com/vue...
    github.com/pra...
    ✅ 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

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

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

    Nice stuff. I'm glad it's so simple and straightforward.

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

    Thanks. Nice showing the various ways.

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

    what a timing. man! your timing is always on point on me.

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

      For me too, those videos are literally JIT.

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

      @@caiovinicius7871 lol nice one 😂

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

    Your videos are very helpful! Is there any possibility on having a tutorial for SSR with Vue 3?

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

    You sir have made my day. been stuck on this for hours!

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

    Short and clear explanation. Thanks!

  • @trayto100
    @trayto100 2 หลายเดือนก่อน

    Nice explanation. On the other hand, I can't understand why not directly using localstorage in your standard functions in this situation. I was hoping to persist data under the rags since I dont want a user to inspect or possibly change the data from local.

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

    Great stuff man, how will you recommend I protect again users directly modifying the localStorage object though, any suggestions on perhaps any other alternative persistence options to use that's more secure ?

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

    You channel is like a gem. Thanks for really cool vids

  • @MW-fm1qq
    @MW-fm1qq 2 ปีที่แล้ว +1

    Great video! It saves me for my course project, thanks for sharing!

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

      glad it helped!

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

    thank you for your straight to the point approach

  • @mez_mez
    @mez_mez 3 หลายเดือนก่อน

    nice video and great explanation. thank you.

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

    useLocalStorage is my favorite one

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

    Vue use is my favourite version, it is so easy to use

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

    With the VueUse, do you really need to wrap it in a ref? According to their docs the function already returns a ref

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

    Thank you, that was way clearer then the pinia docs lol

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

    It would be great to see examples of persistent storage with Nuxt3, without hydration issues. I've made use of the VueUse composable, but even with the example solution using hydration function, I get hydration mismatch in the console. Not sure if to worry about it, but it would be better not to see the issue. Any ideas? Thanks

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

      I use Nuxt3 too, but I have a different issue, on reload, everything it resets, does that also happen to you?

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

      @@eduardocarrilloalbor9459 This happens to me as well

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

    3:17 Why do we need an arrow function here?

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

    Short & concise

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

    First off, I love these videos. They are very informative and incredibly helpful. The presenter though is using a monotone, laundry listing speech pattern that takes away from the content at times.

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

      thanks for the tip - im working on it!

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

      @@LearnVue Yea man! I love your videos and the content in this one specifically is great since most of the pinia videos are for TS. If you could make one or have made one for pinia using the options api that would be hype af.

  • @kirill-petrov
    @kirill-petrov 11 หลายเดือนก่อน

    nice!! piniaPluginPersistedstate good choice

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

    Really useful, thanks 🔥

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

    great video, GOD bless you!!

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

    my favorite way would be to persist with sqlite3 - you have an idea what would be the best way to implement? or do i have to do something customized for that with knex or sequelize?

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

    thanks that was agood quick reference

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

    How on earth does Pinia not persist by default? Sometimes I dont understand what devs are doing.

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

      Why would you want to persist everything?

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

    As a React dev, I'm getting jelly

  • @thulas-mkhwanazi
    @thulas-mkhwanazi 2 ปีที่แล้ว +1

    Great video as always. I noticed in your videos that you don't use Typescript, is there any reason for not using it?

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

      maybe beacuse javascript is more common than typescript

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

    Great video!

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

    How do I persist a Pinia Store to SQLite? Ideally, I'd like to be able to query the Pinia store data within the SQLite database.

  • @676005ga
    @676005ga 2 ปีที่แล้ว

    I have two questions:
    1. If we use the first way, do we register a new watcher whenever we call useUserStore?
    2. How to reset states when user log out?
    Thanks for making awesome content!

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

    thanks a lot!

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

    Is localstorage option work with TS? Actually I tried all options and it doesn't work i any way. Can someone help me please?

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

    hey, i need a vue promise tracker, does any body know some thing or tool to i do for all over the project? thanks.

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

    thank you bru!!

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

    Mantap jiwa raga bang...!!! Jozzz

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

      asik asik

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

    amazing.

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

    Hey, can you make a video explaining why Pinia is supposedly better than vuex?

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

    I have so much problem with Nuxt 3 and pinia persisted state. Anyone have some git or repo I can check out. I don't have errors but my state is still not saved. --> Solution in comments

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

      Hi @Rootster , I am having the same issue, could you make it work?

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

    Well, IMO useLocalStorage gives you the cleanest and most minimalistic approach, also, @vueuse provides a ton of other good utils

  • @chrischambless
    @chrischambless 8 หลายเดือนก่อน

    I appreciate you keeping your content short and sweet, but you could work on varying the inflection of your voice to get your ideas across better. I would describe your manner of speaking as droning or monotone. Every sentence sounds the same, especially the last word of every sentence. And you sound bored. Work on that and your channel will be better.