Is it bad to commit mutations without using actions in Vuex?

懵懂的女人 提交于 2019-12-01 06:38:48

Just keep in mind that mutations have to be synchronous. You can commit directly in components if you (and your team) are sure is there no chance of appearing of something async. In other words, use it with simple and direct operations.

Committing only in actions as a rule adds some clarity and reliability to application's code.

I didn't used Redux, but as far as I know, some state managers have middleware. Using mutations and action (Vuex-way) may cause a difficult maintenance into large applications.

In the future version of Vuex, mutations and actions should be merged into the one entity.

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