As I understand, the best sample of vuex state usage is a shopping cart that can be used by different components or vuex can store auth settings.
But what if I have SPA based on vue-router pages? Should I store page data in vuex state or component.data is good enough for that?
For example, I have SPA with following pages:
/users/
/user/:id
/user/edit/:id
For /user/:id I have the following component structure:
<UserDetailsPage>
<Address :address="user.billingAddress"/>
<UserGroupsList :user-groups="user.groups" />
</UserDetailsPage>
UserDetailsPage retrieves data from API and stores user data object in data().
Components like Address
and UserDetailsPage
receive all data they need from props and just displays data.
Is it a good idea to store user in the page component?