Is Pinia still needed?
I see a lot of colleagues using useState directly. Even for slightly more substantial data at times. But is that correct? Or should you still use pinia?
1 Reply
Its personal preference really and how verbose you want your state management to be. It’s not really about how substantial the data is, because both avenues cater for minimal and heavy data loads. It’s more so about DX and how complex your state is do you then decide the best way for you to organise your state. For me personally, most use cases I can use
useState
and derive composables to accompany state management. But when things get complex and state heavy, I will use Pinia because it will scaffold the majority of state management for me, and I just need to describe that state and it’s logic in independent stores.
This is just covering one aspect of state management. There is a heap of benefit of using either, but it will ultimately come down to what tickles your fancy, how decisive your state management is for its application needs and requirements.
To conclude, I start with useState
and migrate to Pinia when things get repetitive or mundane when organising my state. The world is your oyster.