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 Наука
This is actually insanely high quality tutorial. Keep it up!
Thank you, I've been looking for such a video for a long time
Appreciate this tutorial! I was looking everywhere on how to use the mapstate in the composition api. Thank You!
Absolutely amazing!
Brilliant work Justin!
This video was really helpful and clear, thank you.
Used the helpers in a project im working on, Nice!!!
Thanks for respecting my time.
Good stuff!
thank you so much brother (y)
Thanks for this, i wondered why i couldn't use mapGetters in vue3 composition api.
thanks you!!
👍👍
Love it! but I think the background music a bit to loud.
does the helper gonna work with namespacing?
How does it work with different named spaced modules?
In start I didn't vuex so now can i do it manually?
Do I need to use Vuex 4 in order to use it with composition-api in a vue 2 project?
You'll need Vuex 3, I dont think Vuex 4 is combatiable with vue 3
Nice tutorial, is there a way to do name-spacing?
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)
i don't know when to use options or composition api?
I do lvoe ur videos about vue! I only miss part, where u do tutorial with typescript instead of js only ;/
Options is prefer
What about actions ?
Checkout my other videos
Vuex or composition API? What's better?
If you’re committing from the store, why are you calling the helper function useMutations? Shouldn’t it be useActions?
Commits call mutations, while dispatch calls actions
@@CodingWithJustin you’re right I always get confused, sorry!
ничо нипонил