Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Robstar's avatar

Robstar wrote a reply+100 XP

1w ago

Robstar's avatar

Robstar wrote a reply+100 XP

1w ago

Robstar's avatar

Robstar liked a comment+100 XP

1mo ago

Vue State Management: Ep 4, Introducing Pinia State Management

You can use object destructuring with pinia, you just have to use storeToRefs (https://pinia.vuejs.org/core-concepts/#Destructuring-from-a-Store) for all reactive properties.

const cartStore = useCartStore();
const { cart, subtotal, taxes, total } = storeToRefs(cartStore);
const { incrementProduct } = cartStore;
Robstar's avatar

Robstar liked a comment+100 XP

1mo ago

Vue State Management: Ep 3, Building Our Own State Management Composable

For working with local storage, I like to use VueUse's useStorage (https://vueuse.org/core/useStorage/), which makes the local storage reactive.

Robstar's avatar

Robstar wrote a comment+100 XP

1mo ago

Vue State Management: Ep 2, Mitigating Prop Drilling Using Provide And Inject

I'd probably reach for a composable here as it's much clearer as where the data is from. The coupling is very low too as the composable can be used anywhere in the app. For myself, they're the closest thing to Vuex / Pinia, without using Vuex / Pinia (although everytime I've opted out of using Pinia I've always regretted it - you can see how complicated things get wehn you have nested com,ponents, as in this shoipping cart demo).