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

vincent15000's avatar

When is it justified to use a store (for example Pinia)

Hello,

I know that a store is useful to share data between several components.

I have tried to use Pinia and it seems to be faster than when I call the API for example directly from a component when the component is loading. How is it possible to explain this behavior ?

Furthermore is it a good idea to handle all the datas from the store or is it better to use the store only for the data which have to be shared between several components ?

Thanks for your suggestions ;).

V

0 likes
2 replies
vincent15000's avatar

I just noticed that it's very useful for example to update a table after having added a new model from a modal form.

Instead if sending an event from the modal in order to refresh the table, I just have to update the store and the table is automatically updated with the new item (computed property).

vincent15000's avatar

I also noticed that it's much more easy to manage a form, a modal, ... with a store. No need to use events any more to refresh data, to open or close the modal, ...

Please or to participate in this conversation.