Should I store all the data in vuex state

2019-04-22 13:49发布

If I use Vuex, is that means it's better to store every data in the vuex/state? I have a little confused, some data I get from API (for example UserDetail), I don't need it be shared in components or I counld easily pass it as props. Should I keep that kind of data in Vuex/State? Why not get the data by Promise or only use Vuex/Action/Promise?

标签: vue.js vuex
1条回答
等我变得足够好
2楼-- · 2019-04-22 14:21

Data should be kept as local as possible. That's a general principle that helps reduce complexity. Vuex should handle data that needs to be shared among not-closely-related components.

查看更多
登录 后发表回答