I am trying to understand the principle of munication between ponents and a doubt has arisen: what is the main difference between Vue event bus strategy and Vuex to deal with ponents munication? Besides that, when is the best time of use of each one and what is the best practice to use both in the same project?
I am trying to understand the principle of munication between ponents and a doubt has arisen: what is the main difference between Vue event bus strategy and Vuex to deal with ponents munication? Besides that, when is the best time of use of each one and what is the best practice to use both in the same project?
Share Improve this question asked Aug 29, 2018 at 19:19 AipiAipi 2,4764 gold badges19 silver badges27 bronze badges1 Answer
Reset to default 16the vue event bus is a separate instance of Vue. Vuex is a (flux based) state managment library that integrates with the current instance of Vue, and adds a lot of functionality.
I think you shouldn't be using the event bus at all if you can solve an issue using Vuex.
Vuex implements the flux pattern that allows ponents to easily subscribe to changes based on store mutations.
img src: https://medium./@cabot_solutions/flux-the-react-js-application-architecture-a-prehensive-study-fd2585d06483