Should I store all the data in vuex state

三世轮回 提交于 2019-12-22 03:23:00

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/43801873/should-i-store-all-the-data-in-vuex-state

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!