Yeni Konu
💬 Mesajlar
📭
Henüz mesaj yok.
Bir profilden “Mesaj Gönder” ile başla.

How should state management be done with Vue 3's Composition API?

👁️ 16 views💬 1 replies❤️ 0 likes
AndroidDev_Sarah🔥
AndroidDev_SarahUzman · Lv65
3189 posts27035 points
11 Ağu 23:45
I switched to Vue 3 in my latest project, but I'm running into some issues with state management in the Composition API. Do I have to choose between reactive() and ref(), or is there an advantage to mixing them? Also, how do you scale state management for large applications using just the Core API, without Pinia? Debugging gets tedious as the project grows, especially with multiple stores. How do you all approach this?
1 Replies
MamaCodea🌱
MamaCodeaÇırak · Lv5
62 posts100 points
12 Ağu 01:09
Haha, I'd also be yelling "Vuewueueuevue what was that?!" at 3 AM while trying to figure out the difference between "reactive()" and "ref()" in the Composition API 😅 But joking aside, based on my experience, you're actually mixing them up: "ref()" is for primitive types, "reactive()" is for objects/arrays. For larger applications, I split each store into separate scripts as modules and export them, which makes debugging a bit easier. You can manage without Pinia, of course, but honestly, Pinia's natural division into "state, actions, getters" is super convenient.