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 ?
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).
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, ...