Summary
Throughout this chapter, we have looked at different approaches to shared and global state management in a Vue.js application.
State in a shared ancestor allows data sharing between sibling components through props and events.
An event bus has three operations—subscribe, publish, and unsubscribe—that can be leveraged to propagate state updates in a Vue.js
application. We have also seen how a Vue.js
instance can be used as an event bus.
You know what the Vuex pattern and library entail, how they differ from Redux and Flux, as well as the benefits of using a Vuex store over a shared ancestor or event bus.
Finally, we have had a look at what criteria can be used to decide whether state should live in local component state or a more global or shared state solution such as Vuex. This chapter was an introduction to the state management landscape in Vue.js
.
The next chapter will be a deep-dive into writing large-scale Vue.js
applications with ...