Vuex Crash Course | State Management

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ม.ค. 2025

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

  • @TheCodeholic
    @TheCodeholic 5 ปีที่แล้ว +22

    It's not long time I discovered your channel and surprisingly all of the videos are REALLY valuable.
    ALL OF THEM...

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

      It's not long time I discovered your channel and surprisingly all of the videos are REALLY valuable.
      ALL OF THEM...

  • @mixxamm
    @mixxamm 5 ปีที่แล้ว +270

    8:46 scaffold doesn't work anymore with the latest version of vetur, you should type 'vue' instead.

    • @LinkChenTW
      @LinkChenTW 5 ปีที่แล้ว +4

      Thanks for sharing this information. That's why I can't use "scaffold" now, and I even don't know this is not the default snippet.

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

      I got surprised this week with that too :(

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

      Thank you very much! I was wondering where did it go.

    • @synapps.filip.gorczynski
      @synapps.filip.gorczynski 5 ปีที่แล้ว +1

      Actually there are some templates provided by VS Code plugins, so when you enter vbase and hit tab it should expand into whole section, similarly vdata for data () { return { ket: value } and I suppose many more.

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

      This doesn't work for me anymore. Alternatively you can you "html", "js" and "css" to pass through Ventur the part of the component you need.

  • @Rahul-ym9uh
    @Rahul-ym9uh 4 ปีที่แล้ว +7

    You've got a special talent for keeping this simple and to the point. Even the pasting in of CSS is an excellent idea. Keep up the good work, you've got my money!

  • @DMANCHILD1
    @DMANCHILD1 5 ปีที่แล้ว +111

    Lets Go!! Brad don't stop ever!! Thank you sir.

  • @KehindeOrilogbon
    @KehindeOrilogbon 5 ปีที่แล้ว +31

    Brad is a mind reader... Just opened vuex docs yesterday and still on it, then he uploads this video :D. Thanks Brad

  • @saurabh7199
    @saurabh7199 5 ปีที่แล้ว +50

    I recommended your channel to my friends who are interested in web development..

    • @TraversyMedia
      @TraversyMedia  5 ปีที่แล้ว +6

      Thank you :)

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

      @@TraversyMedia your welcome Brad. I hope you will continue to upload these great content videos in future.

    • @HimanshuPal-li7nj
      @HimanshuPal-li7nj 5 ปีที่แล้ว +4

      & I recommend it to anyone who is not even interested in web Technology .....

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

    Thanks, i'm a working developer and this tutorial is industry standard. Learnt a lot.

  • @izzatullokanoatov370
    @izzatullokanoatov370 5 ปีที่แล้ว +17

    I don't know , dude. Should I stand up or sit down for taking off my hat and say "THANK YOU, bro. That was mind blowing tutorial." . Good luck , bro.

  • @mrrolandlawrence
    @mrrolandlawrence 5 ปีที่แล้ว +4

    im a new convert to Vue. React was driving me nuts (jsx) and when i looked at Angular, Vue just looked better in every way. Thanks for these tutorials.

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

    Sir I love your Videos, but Have it in mind that the next generations won't forget a Hero like you..

  • @cll1out
    @cll1out 5 ปีที่แล้ว

    i just got done watching your vue.js crash course you updated back in January. You said you were gonna do this video "in a couple months." This posted in March. Love how spot-on you were with actually delivering on that promise. Good work sir!

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

    Man this is gold, keep recording new lessons. Explanation, visual are on point, and most importantly it is brief.
    Subscribed and added to watch list on the second video.

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

    for vue3
    index.js:
    import Vuex from 'vuex';
    import todos from './modules/todos';
    // Create store
    export default new Vuex.Store({
    modules: {
    todos,
    },
    });
    main.js:
    import { createApp } from 'vue';
    import App from './App.vue';
    import store from './store';
    const app = createApp(App);
    app.use(store);
    app.mount('#app');

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

      Thankyou Bro!!!!!!!!!!!!!!!!

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

      thank you! this worked when 18:59 wasn't working
      and the error I was getting was
      error 'axios' is defined but never used no-unused-vars

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

      uff I was going crazy on this thanks :D

  • @cyphen21
    @cyphen21 5 ปีที่แล้ว

    Subscribed to this channel like 8 months ago. Dont regret it at all.

  • @andrewkiminhwan
    @andrewkiminhwan 5 ปีที่แล้ว

    no one else is uploading consistently like brad on youtube. the absolute GOAT

  • @rakibulhasan8431
    @rakibulhasan8431 4 ปีที่แล้ว

    your tutorials help me a lot for my first job as a software engineer. I'm grateful to Traversy media

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

    If you want to use mapGetters like he does in 17:26 you now have to add the spread operator pointpointpoint infront of it -> *...mapGetters(['allTodos'])*

  • @LucXX36
    @LucXX36 5 ปีที่แล้ว

    At 47:15 you can just use something like "const limit = document.getElementById('id_name_of_select_element').value;" to get the value of the element. Don't forget to give your element the id you passed into this const variable

  • @jasonjjavier6693
    @jasonjjavier6693 5 ปีที่แล้ว +7

    Your Crash Course is great, I have watched it since I'm in first year college and now I'm in an industry. Great help! Thank you.

    • @christianm6268
      @christianm6268 4 ปีที่แล้ว

      wow thats a very nice of u jason. good to know

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

    Thanks Brad. I'm learning Vue and this is really helpful. Also what I like is you don't speak / code too fast so that I can code while you speak.

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

    Thanks, Brad!
    That really helped me understand faster how to use Vuex. It's simple and elegant. So easy once you get the hang of it. Keep up to awesome work!

  • @Indialoves1
    @Indialoves1 4 ปีที่แล้ว

    Brad, I am not only learning new things from you but also the coding structure you do is very clear and easy to understand.

  • @harbilito4910
    @harbilito4910 5 ปีที่แล้ว +12

    47:30 , you could just type $event.target.value in the @change method in FilterTodos.vue

    • @kyrierevival3658
      @kyrierevival3658 5 ปีที่แล้ว

      also use event target value in todos.js?

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

      ​@@kyrierevival3658 I boiled it down to const limit = parseInt(e.target.value); but I notice there are more concise options

    • @adityakunhare
      @adityakunhare 4 ปีที่แล้ว +3

      None of it is working, I am getting event.target is undefined in the todos.js (module) on console.log

  • @PaoPaw098
    @PaoPaw098 4 ปีที่แล้ว +17

    You can easily change the `$event` part in the filterTodos by this:
    Add/Replace this in FilterTodos.vue file
    1. __
    2. __
    _import { mapActions } from 'vuex';_
    _export default {_
    _name: "FilterTodos",_
    _data() {_
    _return {_
    _limit:0_
    _}_
    _},_
    _methods: {_
    _...mapActions(['filterTodos']),_
    _onChange() {_
    _this.filterTodos(this.limit);_
    _}_
    _},_
    _};_
    __
    Add/replace this in todos.js (module) file
    1. In _actions_ add this instead
    _async filterTodos({ commit }, limit) {_
    _const response = await axios.get(`__jsonplaceholder.typicode.com/posts?_limit=${limit}`)__;_
    _commit('filteredTodos', response.data);_
    _}_
    2. In _mutations_ add this instead
    _filteredTodos: (state, todos) => state.todos = todos_

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

    Thank you for being soooo generous. I have 2 days of programming experience haha and your channel is really inspiring me to work learn work learn work learn.

  • @overnightmares
    @overnightmares 5 ปีที่แล้ว +16

    Hi Brad,
    @48:00 why didn't you just use e.target.value ?

  • @ebrahimmohammadi5489
    @ebrahimmohammadi5489 4 ปีที่แล้ว

    It is one of the shortest and best videos to learn using Vuex in your projects, Thanks Brad and thanks Traversy Media

  • @TheBaltLT
    @TheBaltLT 4 ปีที่แล้ว

    Much appreciated. Thank you for the quality and no annoying selfies. Best of luck.

  • @pixikraft9617
    @pixikraft9617 5 ปีที่แล้ว

    Thank you Brad. We are so so lucky to have you and i wish you success in all your projects because you deserve it.

  • @johnnya1717
    @johnnya1717 3 ปีที่แล้ว

    you're the only one who describes things clear. thank you

  • @benpohl7186
    @benpohl7186 5 ปีที่แล้ว

    Our team is switching to Vue and this tutorial has been super helpful for me. Thank you so much!

  • @MuhammadRizkyEkaArlin
    @MuhammadRizkyEkaArlin 5 ปีที่แล้ว

    These crash courses are absolute miracles!!! Enough to get you started without leaving a confusion :D

  • @allandacasin9041
    @allandacasin9041 5 ปีที่แล้ว +71

    Life should be simple or minimal. I'm moving now to Vue from React.

    • @maskman4821
      @maskman4821 4 ปีที่แล้ว

      awesome !!!

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

      yeah IMO React is trash

    • @i-am-learning-life
      @i-am-learning-life 4 ปีที่แล้ว

      Same here 🤣🤣

    • @romankocherezhchenko34
      @romankocherezhchenko34 4 ปีที่แล้ว +3

      I have no idea why people still use React, when Vue, Svelte and other awesome framworks exist, idk

    • @romankocherezhchenko34
      @romankocherezhchenko34 4 ปีที่แล้ว +3

      @@f000ghk Even junior can rebuild React app to Vue, but Vue to React don't.

  • @melrok1
    @melrok1 3 ปีที่แล้ว

    this channel is guaranteed to be a subscription. Keep going and I wish you a lot of success.

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

    Literally stumbled upon this problem in my project, glad to find vuex

  • @nvjrane
    @nvjrane 4 ปีที่แล้ว

    This is the best video ever for learning VUEX in such a short time. Thanks a lot! Keep going!

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

    You are the best teacher I've come across... Thanks for keeping it real. Respect

  • @PhonePhaan
    @PhonePhaan 4 ปีที่แล้ว

    really good tutorial, I was just brushing my vuex skills,
    Quick note: - instead of using event for filter you can use local data(state) and on change on select makes it easier

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

    Thank you so much! After watching the Vue Crash Course and this one, I immediately became a patron. Love your content!

  • @spongechameleon6940
    @spongechameleon6940 4 ปีที่แล้ว

    Wow man, your stuff has always been great but this video in particular is really a whole new level. I learned way more from this than I thought I was going to. Thank you man, hope you're healthy and vibing in quarantine

  • @cajogos
    @cajogos 4 ปีที่แล้ว +3

    Can always count on you to have a tutorial for things I need to quickly learn.
    I hope you don't mind I listen to your videos on 1.75x speed! You still sound awesome! I just lack time these days... It's not you... it's me.

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

    For those who encountered TypeError: Cannot read properties of undefined (reading 'use') -- Remove the line Vue.use(Vuex) in index.js will do. It took me hours to figure it out :")

  • @railroadandindustrialsky-wv8ns
    @railroadandindustrialsky-wv8ns ปีที่แล้ว

    Clear and concise walkthrough. You got me a job Brad. Thanks.

  • @alextheblockchaindev
    @alextheblockchaindev 5 ปีที่แล้ว +30

    Thank you for providing so much value to the community!!! 👍👍👍👍👍👍👍👍👍👍👍👍👍👍

  • @RawCoding
    @RawCoding 5 ปีที่แล้ว

    Great to see sucha massive tutorial dedicated solely to vuex. Well done

  • @speaktothepoint2108
    @speaktothepoint2108 5 ปีที่แล้ว

    Edison didn’t sleep 8 hours per day because, he didn’t ask internet for an advice. Hard work has no substitute. Thanks Brad.

  • @SebastianPerezG
    @SebastianPerezG 5 ปีที่แล้ว

    I'm just starting with vuex , this tutorial comes very handy !!! , i like the way that you explain man.

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

    Brad this tutorial was so clear and informative! Keep up the excellent work!

  • @dulerong5
    @dulerong5 4 ปีที่แล้ว

    Thank you so much Brad, your content is one of the most educational content on TH-cam, thank you.

  • @petersutton1609
    @petersutton1609 4 ปีที่แล้ว

    Thanks Brad, was pulling hair after moving project to SPA with vue-router, this is the way to go!! :)

  • @acollierr17
    @acollierr17 5 ปีที่แล้ว

    Thank you so much for this video and in general what you do! For a while, I have been quite confused about state management. But my confidence has increased after watching this video. Time to implement and build a foundation from this video for my own site. Again, thank you!

  • @mehtabahmed6092
    @mehtabahmed6092 3 ปีที่แล้ว

    Thank you so much, you really made my life essay as I needed it in my thesis. Most important the comparsion with Redux was very useful as I knew it already.

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

    Thanks, this helped clarify a few things for me. State management can be confusingly awesome.

  • @kamalhm-dev
    @kamalhm-dev 5 ปีที่แล้ว +23

    nuxt js next please!

  • @steliosvoskos9610
    @steliosvoskos9610 4 ปีที่แล้ว

    Thanks for sharing such high quality material for free. Excellent course about Vue and Vuex - I am starting a new role on Monday and those courses helped a lot.

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

    48:24 Why don't you just put a v-model on the select, assign it to a variable limit and then add an onChange and call filterTodos from there?

  • @tepchiva8342
    @tepchiva8342 3 ปีที่แล้ว

    I recommended your channel to my friends who are interested in web development,
    I'm so thank you for good video share 💖💖💖

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

    Creating store & adding module inside the store at 12:40 did not work for me. The below one did:
    import { createStore } from 'vuex'
    import todos from './modules/todos';
    // Create a new store instance.
    export default createStore({
    modules: {
    todos
    }
    });

  • @kshirodpatel
    @kshirodpatel 5 ปีที่แล้ว

    Brad love you man. The way you describe those stuffs it looks like wow how easy was that.

  • @gillfromamritsar
    @gillfromamritsar 5 ปีที่แล้ว

    you are doing an awesome work!, I have recommended your channel to lot of friends to learn and move forward in career.

  • @AvenalSzarosiwy
    @AvenalSzarosiwy 5 ปีที่แล้ว

    Hoooly... i just watched vue crash course and i thought it would be cool if you could do vuex course. You are a beast, Brad!

  • @yeorinim2sida
    @yeorinim2sida 5 ปีที่แล้ว +7

    8:46 "scafold(tab)" changed to "vue(tab)"

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

    At 46:44 when I console log the event I get: {getters: {…}, state: {…}, rootGetters: {…}, dispatch: ƒ, commit: ƒ, …}. How do I resolve this? Because I am unable to get event.target

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

      Ok never mind, realized this happens when you try and get the event without a commit in the async function

    • @liviuiosim1870
      @liviuiosim1870 4 ปีที่แล้ว

      @@andreminnie5981 Thank you, saved me a few minutes with this comment

  • @nuradiltursun6298
    @nuradiltursun6298 5 ปีที่แล้ว

    jsut complete right now,step by step......thank you man

  • @EdwardGranville
    @EdwardGranville 5 ปีที่แล้ว

    Sir, you seriously rock! Very well explained in a relaxed and clear way.

  • @virginielaborde9440
    @virginielaborde9440 3 ปีที่แล้ว

    great course! quick, detailled & helpful, even if you never worked with state management

  • @AdnanAbbasi_LXXVIII
    @AdnanAbbasi_LXXVIII 4 ปีที่แล้ว

    Excellent video again, I so much like following your videos, explained in very detail and thorough, I like the fact that you make a mistake and then fix it in front of us, everything is so natural :-)

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

    Just really need to thank you cos you make things seem super easy, Kudos

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

    Great timing , just learning vuex myself :) so this should be very helpful, will we be seeing a nuxt crash course soon? Hope so!

  • @RIGTTrader
    @RIGTTrader 5 ปีที่แล้ว

    on min 54:35 , why didn't you just used the map function from the array object to iterate through and returned the correct version of the updated todo? Just trying to understand a reason why you didn't use that, and take into account other considerations to prevent mistakes in my own code?

  • @adrianoalves-qripto
    @adrianoalves-qripto 5 ปีที่แล้ว

    Thank you very much Brad for your passion and knowledge sharing. Greetings from Brazil Vuejs Community!

  • @IngPedroAraujo
    @IngPedroAraujo 5 ปีที่แล้ว

    This was a great video tutorial; It helps me clarify some concepts about Vuex. Obviously, this is not for a beginner. Great job! Thank you for sharing your knowledge; I wish you success in everything you do. Thank you

  • @shejininj2041
    @shejininj2041 4 ปีที่แล้ว

    34:58 title not showing in component, when i console it showing, but not rendering...

  • @lerouxvermeulen4403
    @lerouxvermeulen4403 3 ปีที่แล้ว

    Damn dude, what a lifesaver! You are the best.

  • @PatrickSierak
    @PatrickSierak 5 ปีที่แล้ว

    In between the grid spaces of todos it is actually an optical illusion. You see grey dots between the spaces of the todos you are not looking at 35:36

  • @alecprologg
    @alecprologg 3 ปีที่แล้ว

    So clear and concise, as always ! Thanks a lot Brad !

  • @mk-13579
    @mk-13579 5 ปีที่แล้ว +1

    Awesome content, Brad. Thanks a lot.
    These crash courses you make are just gold. Its so awesome to get up to speed on few things here and there so quickly.

  • @korndev6862
    @korndev6862 5 ปีที่แล้ว

    this crash course is very nice, i so understand everything about vuex. thank you very much sir.

  • @gaos94
    @gaos94 5 ปีที่แล้ว

    Thanks Brad! I got interested in web development thanks to you, I currently have 2 years working mostly on React, don't love Vue (don't dislike it either) but is good to know other ways to do the same thing.

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

    at 19:00 I am getting error" [vuex] unknown getter: allTodos vuex.esm.js?2f62:897 "

    • @srdjagunjic
      @srdjagunjic 5 ปีที่แล้ว

      Have you fixed it?

    • @vivekbhatt26
      @vivekbhatt26 5 ปีที่แล้ว

      @@srdjagunjic yes import store from store/ the / was missing

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

      @@vivekbhatt26 OMG!! Thank you so much! For the last 1.5 hours I am trying to fix this... I can now continue with this tut. Can you tell me why is that / a problem?
      Thanks man!

    • @alecselinger22
      @alecselinger22 4 ปีที่แล้ว

      if anyone else is suffering from this, I made the mistake of importing the Todo vue instead of the todo.js file in the store index.js

  • @michaelkendagor4322
    @michaelkendagor4322 3 ปีที่แล้ว

    This has been life changing to me .. thanks man.. God bless

  • @Cpt_Chirp
    @Cpt_Chirp 5 ปีที่แล้ว

    fantastic tutorial. perfect speed and everything is super clear.

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

    Just like aways, I've learned a lot here! Thank you, dude!

  • @arnoldgamarra8425
    @arnoldgamarra8425 4 ปีที่แล้ว

    Hi from Peru, thanks for sharing this awesome course about VUEJS

  • @TylerPotts
    @TylerPotts 5 ปีที่แล้ว

    Yes, I've been waiting for more VueJS from you :)

    • @praveenhype6672
      @praveenhype6672 3 ปีที่แล้ว

      and now we are waiting for more VueJS tutorials from you

  • @MrAndreaGero
    @MrAndreaGero 4 ปีที่แล้ว

    25:00 Json placeholder api call remains pending and no response is provided, anyone have tihis problem?

  • @EricLansher786
    @EricLansher786 4 ปีที่แล้ว

    Your content is amazing, Simple and very effective. Keep it up.

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

    Another fantastic tutorial! Thanks brad!

  • @rahul_bali
    @rahul_bali 4 ปีที่แล้ว

    14:20
    1:8 error 'axios' is defined but never used no-unused-vars

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

    24:50 I am getting Uncaught (in promise) TypeError: this.$store is undefined. in the console. I am using VUE 3. #help

  • @alvinkariuki236
    @alvinkariuki236 4 ปีที่แล้ว

    this tutorial is just golden, thank you so much

  • @can9113
    @can9113 5 ปีที่แล้ว

    Amazing. Thanks to you I understood all the topics about Vuex.

  • @divyavishwakarma2002
    @divyavishwakarma2002 4 ปีที่แล้ว

    You could've also filtered the todos by emitting an event from the child component and passing range from there to the parent component. I did it this way and it doesn't even require you to make a new request to the server.

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

    Some suggestions...
    1. You can use e.target.value when filtering
    2. When updating, you can use a patch request and just pass in completed in the request body, and call the update todo action directly in the double click listener
    Great video as always!

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

    Idk why but i always dance whenever i hear your bg intro HAHAHA

  • @benjaminwaye6477
    @benjaminwaye6477 4 ปีที่แล้ว

    Excellent tutorial! I noticed that removing some await(s) fixed the timing issue

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

    This was a good course Brad, but I think you made a mistake to show only using ...mapActions and ... mapGetters when writing Vuex code, as it is easier (and cleaner in many cases) to use this.$store.dispatch() and this.$store.commit() in components versus overly complicating things trying to be elegant using the ...map feature of Vuex when you can just use the global. Thanks for the good work!

  • @fernandobravodiaz3972
    @fernandobravodiaz3972 4 ปีที่แล้ว

    A nice tutorial. Simple, concise and well explained.

  • @nilmendes7710
    @nilmendes7710 5 ปีที่แล้ว

    This tutorial helped me a lot!
    Valuable tips.
    Thanks for sharing your knowledge and time.
    Success in your projects.

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

    I know this video is a little old, but how do you add Vuex to the a Vue3 main.js? There isn't like a new Vue() function in my main.js