Vuex Basics in Vue 3 with Composition API in 6 minutes

Поделиться
HTML-код
  • Опубликовано: 26 июн 2024
  • Today we will be creating a simple counter app from scratch to learn the basics of using Vuex 4 with Vue 3 Composition API. We'll start by taking a look at Vuex concepts like state, getters, and mutations and how to use them within the options API, then we will switch over the compositions API and implement the same functionality. We'll also create some reusable helper functions to make accessing the store in the composition API more readable.
    #vue #vuex #composition-api
    Discord - / discord
    Twitter - / jsbroks
    ⚡ RESOURCES ⚡
    Vuex 4 Docs - next.vuex.vuejs.org/guide/#th...
    Vue 3 - v3.vuejs.org/
    Composition Vuex Helper functions Issue - github.com/vuejs/vuex/issues/...
    Source Code - github.com/codingwithjustin/v...
    ⭐ TIMESTAMPS ⭐
    0:00 - Intro
    1:08 - Creating a project
    1:17 - Vuex Concepts
    2:45 - Options API
    3:35 - Vuex map Functions
    4:24 - Composition API
    5:00 - Composition Helper Functions
    6:02 - Conclusion
  • НаукаНаука

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

  • @zbynekjurica
    @zbynekjurica 3 года назад +8

    This is actually insanely high quality tutorial. Keep it up!

  • @user-mg3ul1zb3s
    @user-mg3ul1zb3s 3 года назад +1

    Thank you, I've been looking for such a video for a long time

  • @Squawkize
    @Squawkize 3 года назад +2

    Appreciate this tutorial! I was looking everywhere on how to use the mapstate in the composition api. Thank You!

  • @luischinchilla-garcia5640
    @luischinchilla-garcia5640 3 года назад +1

    Absolutely amazing!

  • @arsalabangash
    @arsalabangash 3 года назад +1

    Brilliant work Justin!

  • @pavelino17
    @pavelino17 2 года назад

    This video was really helpful and clear, thank you.

  • @Majik_exe
    @Majik_exe 3 года назад

    Used the helpers in a project im working on, Nice!!!

  • @namero999
    @namero999 2 года назад

    Thanks for respecting my time.

  • @carlomigueldy
    @carlomigueldy 3 года назад

    Good stuff!

  • @Useroelas97
    @Useroelas97 2 года назад

    thank you so much brother (y)

  • @dexmbachu
    @dexmbachu 7 месяцев назад

    Thanks for this, i wondered why i couldn't use mapGetters in vue3 composition api.

  • @mauriciom7691
    @mauriciom7691 Год назад

    thanks you!!

  • @bunnyhaldar8740
    @bunnyhaldar8740 3 года назад +1

    👍👍

  • @wijaksanapanji
    @wijaksanapanji 3 года назад +2

    Love it! but I think the background music a bit to loud.

  • @ZynthProductions
    @ZynthProductions 3 года назад +1

    does the helper gonna work with namespacing?

  • @SirAlexMayo
    @SirAlexMayo 2 года назад

    How does it work with different named spaced modules?

  • @gtbaba123
    @gtbaba123 Год назад

    In start I didn't vuex so now can i do it manually?

  • @shutterradio
    @shutterradio 3 года назад

    Do I need to use Vuex 4 in order to use it with composition-api in a vue 2 project?

    • @CodingWithJustin
      @CodingWithJustin  3 года назад

      You'll need Vuex 3, I dont think Vuex 4 is combatiable with vue 3

  • @SyedHaroon786
    @SyedHaroon786 3 года назад

    Nice tutorial, is there a way to do name-spacing?

    • @rngbaguette
      @rngbaguette 2 года назад

      Yes there is! For the state for example, you’d need to put in the namespaced „path“ so to say after your desired property: store.state.some.module.counter
      store.getters.some.module/getCounter
      store.commit(some.module/SETCOUNTER, payload)

  • @zombaju
    @zombaju 3 года назад

    i don't know when to use options or composition api?

  • @Byku010
    @Byku010 3 года назад +2

    I do lvoe ur videos about vue! I only miss part, where u do tutorial with typescript instead of js only ;/

  • @yuvoria.official
    @yuvoria.official 3 года назад

    Options is prefer

  • @kinax2
    @kinax2 3 года назад

    What about actions ?

  • @yeravl
    @yeravl 2 года назад

    Vuex or composition API? What's better?

  • @robertotonino2916
    @robertotonino2916 3 года назад

    If you’re committing from the store, why are you calling the helper function useMutations? Shouldn’t it be useActions?

    • @CodingWithJustin
      @CodingWithJustin  3 года назад +1

      Commits call mutations, while dispatch calls actions

    • @robertotonino2916
      @robertotonino2916 3 года назад

      @@CodingWithJustin you’re right I always get confused, sorry!

  • @LukeryaPereprygova
    @LukeryaPereprygova 3 года назад +1

    ничо нипонил