Learn Vuex by Example - Handling Vue State Management

Поделиться
HTML-код
  • Опубликовано: 29 сен 2024
  • Written tutorial: goo.gl/dNv4aU
    Enjoy? SUBSCRIBE! and check out coursetro.com for more.
    In this tutorial, we're going to learn all about Vue state management (Vuex). We'll do so by creating a simple app that will help demonstrate how to use Vuex.
    Let's rock!
    - - - - - - - - - - - - - - - - - - - - - -
    Subscribe for NEW VIDEOS weekly!
    My site: designcourse.com
    My personal FB account: logodesi...
    Coursetro FB: coursetro
    Coursetro's Twitter: / designcoursecom
    Join my Discord! / discord
    ^-Chat with me and others
    - - - - - - - - - - - - - - - - - - - - - -
    Who is Gary Simon? Well, I'm a full stack developer with 2+ decades experience and I teach people how to design and code. I've created around 100+ courses for big brands like LinkedIn, Lynda.com, Pluralsight and Envato Network.
    Now, I focus all of my time and energy on this channel and my website Coursetro.com.
    Come to my discord server or add me on social media and say Hi!

Комментарии • 88

  • @jgkdmdevienjjgg8866
    @jgkdmdevienjjgg8866 6 лет назад +9

    You shoudn't import REMOVE_ALL mutation to component in the end

  • @SunilKumar-fh6jk
    @SunilKumar-fh6jk 6 лет назад +1

    Thank you so much!

  • @mohammadrezaasadi6529
    @mohammadrezaasadi6529 4 года назад

    awsome awsome.....!

  • @Max-cr3dz
    @Max-cr3dz 6 лет назад +15

    When an awkward joke ment to be funny but remained awkward :D

  • @LaurentVanDessel
    @LaurentVanDessel 6 лет назад +5

    Hi, great tutorial! Have a small question though.
    What's the reason you define both ...mapActions(['removeLink']) as a removeLink function that calls this mapped action in the HelloWorld component? I just omitted this last "removeLink" function and that works perfectly fine too? Perhaps that's only necessary if you would like to do execute some extra modifications to the view?
    Also in the last step ("Stats" component), you both do ...mapMutations as ...mapActions. Doesn't only doing ...mapActions suffice?

    • @easy-stuffs
      @easy-stuffs 6 лет назад +1

      Happy to see someone has the same question as mine.. :-) Hope Gary reply for that soon..

    • @tycooperaow
      @tycooperaow 5 лет назад

      @@easy-stuffs still no reply

  • @easy-stuffs
    @easy-stuffs 6 лет назад +4

    Since you have directly triggered ADD_LINK to add a new link without using any mapActions then why can't you do the same to REMOVE_LINK and REMOVE ALL? Any reasons?

    • @blacklotus1606
      @blacklotus1606 6 лет назад

      he actually mentioned it, if you want to do [ a sync call ]then use MapAction. listen from 25:05

  • @DavidVII7
    @DavidVII7 6 лет назад +4

    Great primer to vuex that's easy to follow. Thanks for putting this together. Cheers!

  • @real-oppenheimer
    @real-oppenheimer 6 лет назад +11

    31:36 Why do you import mapMutations at this point? Isn't mapActions sufficient?

    • @KFGhostFace
      @KFGhostFace 5 лет назад +1

      legit thinking the exact same thing. the component should only need to be aware about creating actions and sending payloads afaik

    • @renwar
      @renwar 4 года назад

      No need to import mapMutations.

  • @daledurham3048
    @daledurham3048 6 лет назад +3

    Why did you need to map the mutation for REMOVE_ALL? All you did was dispatch the action. You never referenced the mutation in the component.

    • @crazieeez
      @crazieeez 6 лет назад

      I agree. Mutation and State should not be in component. Only mapGetters and mapActions should be in component.

  • @yaesmucho
    @yaesmucho 5 лет назад +1

    you are really good at talking , great voice, easy to keep up tempo.. im enjoying this and other nuxt vuex courses... you are not the only one, but sure one to keep up coming back to..

  • @vladhusnullin1650
    @vladhusnullin1650 6 лет назад +1

    Why do we have to map Actions from the store - if we actually are not going to bind HTML events to those store actions ? maybe there is a way to just call those actions directly, without mapping it to components methods ?

  • @geleiva
    @geleiva 6 лет назад

    this is the post [coursetro.com/posts/code/144/A-Vuex-Tutorial-by-Example---Learn-Vue-State-Management]

  • @kingzeddicus
    @kingzeddicus 6 лет назад +1

    You sir just earned a new subscriber! I have learned a lot from just this tutorial. Thank you for your hard work. I hope you keep making videos like this in the future.

  • @andrewkiminhwan
    @andrewkiminhwan 6 лет назад +1

    truly a big fan of these Vue videos. thanks!

  • @kimie126
    @kimie126 4 года назад

    why my color is gray, not pink like yours?

  • @dominikkietyka9523
    @dominikkietyka9523 6 лет назад +1

    it's better than angular?

  • @nowacry
    @nowacry 6 лет назад +2

    where do you define the ?

    • @PVideos10
      @PVideos10 6 лет назад

      routerView becomes available automatically when you choose to use routes. router.vuejs.org/api/#router-view

  • @j.d.3890
    @j.d.3890 5 лет назад

    I didn't get why not just use this.$store.dispatch("removeAll") in methods? No need to do any imports or additional declarations.

  • @tyresew.4233
    @tyresew.4233 6 лет назад

    Now look if somebody ran into an error Maximum Call Stack exceeded on removeLinks()
    I found a solution. So under Methods, in mapActions its referenced as 'removeLink' but when defining it its removeLinks (plural) .
    ...mapActions([
    'removeLink'
    ]),
    addLink: function() {
    this.ADD_LINK(this.newLink)
    this.newLink = '' // empty when
    },
    //plural
    removeLinks: function(link) {
    this.removeLink(link)
    }
    }, /

  • @handle13699
    @handle13699 6 лет назад

    Great tutorial, thanks. I made this project with Nuxt and everything worked well. The only problem I got is that when executing the removeAllLinks method the links array is set to 0 after 1.5s but the is not updated, the links are still displayed and the App needs to be refreshed. Any idea what is happening?

  • @ThePrintLife
    @ThePrintLife 6 лет назад +1

    I have started the development a screen printing shop management system. How would one go about making sure they have the proper implementation plan.

  • @jonecir
    @jonecir 6 лет назад

    Hi Gary, really nice tutorial! Congrats! I also tried to add a link by creating an Action and it worked just fine. So what's the difference between calling the mutation (this.ADD_LINK(this.newLink)) and the action such as ( this.addLink(link) )?

  • @_rachid
    @_rachid 4 года назад

    Thanks for this. Vuex is simple to use than redux with React.js.

  • @tododigital3725
    @tododigital3725 5 лет назад

    just wondering if name: 'Stats' is necessary as you are using export default which will take the filename.

  • @DhanaLakshmi-yn7wi
    @DhanaLakshmi-yn7wi 5 лет назад

    Nice video, what is the difference between mutators and actions ?? We can remove an element in mutators right??

  • @joe44850
    @joe44850 5 лет назад

    Great tutorial. But no, RUclips, I do not want to learn to draw, even if I see the commercial 27,000 times.

  • @edarioq
    @edarioq 5 лет назад

    Getting Error in v-on handler: "TypeError: this.ADD_LINK is not a function" with Typescript :(

  • @Max-cr3dz
    @Max-cr3dz 6 лет назад

    What is a good practice to attach data from a database to vuex? At what point should it be fetched and passed to vuex? Should it also be done through mutations?

  • @LifestylePro201
    @LifestylePro201 6 лет назад

    very good tutorial i have already use vuex but this good example for map action map state and mutation we can use a standard way of coding.

  • @dudeking1000
    @dudeking1000 5 лет назад

    why is mapGetters defined in computed and mapAction defined in methods?

  • @abdalrhmanmahmoud5725
    @abdalrhmanmahmoud5725 6 лет назад

    i am a beginner should i start with vuex or made some project with vue at first

  • @mrashad_com
    @mrashad_com 5 лет назад

    Awesome, this tutorial make Vuex looks very easy, thank you

  • @rubinbajracharya9319
    @rubinbajracharya9319 6 лет назад

    Awesome stuffs. Thanks. Also can you also make a video related to SEO in Angular 5 and above and how to host the site made in heroku or other. Thanks

  • @jtktam
    @jtktam 6 лет назад

    For future courses can we have some typescript examples?

  • @jitujack007
    @jitujack007 5 лет назад

    how to use state in component itself(Not in HTML)?

  • @lowkeygaming4716
    @lowkeygaming4716 5 лет назад

    Really nice example. Very simple and informative

  • @khanriza
    @khanriza 5 лет назад

    Unreal tutorial. Thank you very much.

  • @fachrizalrifahdi
    @fachrizalrifahdi 5 лет назад

    whats mean "..." after mapState function?

  • @tanveeriqbal6680
    @tanveeriqbal6680 6 лет назад

    You are too good. Great video on Vuex. Learned a lot. thanks

  • @mamadoundiade2764
    @mamadoundiade2764 6 лет назад

    Thank a lot for this tutorial, it really helps me to more understand vuex concept ! Thank again.

  • @maxmaksum4673
    @maxmaksum4673 4 года назад

    Awesome

  • @gokudomatic
    @gokudomatic 5 лет назад

    Really nice tutorial. Thanks a lot!
    But I'll need you to go ahead and stop saying "I'll go ahead". That'll be great, m'kayyy.

    • @dejo095
      @dejo095 5 лет назад

      Geez, the nerve of some people!

  • @imranshaikh115
    @imranshaikh115 5 лет назад

    Thank you very much for this kind of beautiful explanation

  • @rudstoncullen3410
    @rudstoncullen3410 6 лет назад

    Excellent Saved my day! Thanks

  • @LNTutorialsNL
    @LNTutorialsNL 6 лет назад +14

    0:36 libertarian confirmed

    • @philosophersam
      @philosophersam 6 лет назад +1

      after hearing that, I needed to watch some Tom Sowell :-)

    • @rodrigz
      @rodrigz 6 лет назад

      Who doesn't hate tho?

    • @latiendamac
      @latiendamac 6 лет назад +1

      ruclips.net/video/qLcc19mt4eA/видео.html needed

    • @di3g04
      @di3g04 5 лет назад

      Taxation is theft

  • @tomvito
    @tomvito 6 лет назад

    Great video! Thanks :)

  • @Ruby-od2wn
    @Ruby-od2wn 6 лет назад

    Awesome thanks for good tutorial..

  • @thomaswhelton8864
    @thomaswhelton8864 6 лет назад

    4:03 not sure how to hineniner

  • @meghan1798
    @meghan1798 6 лет назад

    Thanks for the amazing tutorial!!

  • @hardcodd
    @hardcodd 6 лет назад

    The best of the best! Thanks a million!

  • @ViralVideosCompilations
    @ViralVideosCompilations 6 лет назад

    awesome video

  • @graceokolo3036
    @graceokolo3036 6 лет назад

    Thanks a lot for the tutorial!!

  • @jasonj6550
    @jasonj6550 6 лет назад

    Thanks i learned alot!

  • @jimh7604
    @jimh7604 5 лет назад

    great tutorial !!!

  • @yaesmucho
    @yaesmucho 5 лет назад

    is this a little outdated? its August 3 2019.

    • @bashovski
      @bashovski 5 лет назад

      No, it's not. Feel free to follow the steps from this video.

  • @fauzanadhima8961
    @fauzanadhima8961 6 лет назад

    Good tutorial 👍👍 .

  • @georgesmith3022
    @georgesmith3022 6 лет назад

    i reinstalled vue-cli but it still show 2.9.3

    • @georgesmith3022
      @georgesmith3022 6 лет назад

      i found out npm install -g @vue/cli

    • @marks.4405
      @marks.4405 6 лет назад

      Please add the source code to github, Thanks

  • @iNVICTUX
    @iNVICTUX 5 лет назад

    Nice

  • @meeshell74
    @meeshell74 6 лет назад

    Thank you!

  • @HaiderAli-co9jl
    @HaiderAli-co9jl 5 лет назад

    19:52

  • @humanexe5451
    @humanexe5451 6 лет назад

    Why is this better than PHP and regular Javascript?

  • @mediocrelove9736
    @mediocrelove9736 5 лет назад

    You're the man! Thanks

  • @DindaneChahinaz
    @DindaneChahinaz 6 лет назад

    I still don't understand why people code on windows... We're in 2018...

    • @DesignCourse
      @DesignCourse  6 лет назад +3

      I still don't understand why people bitch and moan about which OS others use... Like, we're soooooo in 2018!!!!

    • @DindaneChahinaz
      @DindaneChahinaz 6 лет назад

      We are forced to use Linux at university, and when we want to lean, people code on windows. It's been already 4 years that i hear my tearchers be like "Noo, don't code on windows, yes linux and mac is better, yes to open source, oh you have windows, where here -10 on your test 'cause that's bad".
      And I'm not your friend, so don't tell me that i bitch or moan. If you can't give a proper answer, well don't.
      I'm here to lean, not for you to scream at me.
      Thanks.

    • @DesignCourse
      @DesignCourse  6 лет назад +2

      I was recently quoted as saying, "Don't go to school for code." You've given me reason #427 to add to the list of reasons: Stupid professors 😂
      And if you were really here to learn, you would have omitted the snarky "We're in 2018.."
      I'll give you an answer though. Back in the late 90s when you were in diapers, I liked to game and code, thus PC.
      Back in the early 2000's, I had an aversion towards computers that looked like toys (iMac).
      Back 8 years ago I still liked to game and code, but I also had an aversion towards weird looking soyboys in silly commercials (Justin Long).
      Throughout all of this, I could always easily upgrade, build equivalent PC's for half the cost, and design / code whatever I wanted.
      ...are we BFF's yet?

    • @DesignCourse
      @DesignCourse  6 лет назад +2

      Maybe I'll elaborate on today's live show! Tune in at 10:30am et and I'll give you a shout out!

    • @DindaneChahinaz
      @DindaneChahinaz 6 лет назад

      Actually, everything i've learn isn't because of school or university.
      Sorry for "We're in 2018", that's a misunderstanding.
      Of course we're still BFF, i learned lot of thing thanks to you.