Chapter 6. Caching the Current Folder Structure Using Vuex
In this chapter, we are going to introduce an official Vue plugin called Vuex. Vuex is a state management pattern and library that allows you to have a centralized store for all your Vue components, irrelevant of whether they are child components or a Vue instance. It gives us a centralized, simple way of keeping our data in sync across the whole app.
This chapter is going to cover:
- Getting started with Vuex
- Storing and retrieving data from the Vuex store
- Integrating Vuex with our Dropbox app
- Caching the current Dropbox folder contents and loading data from the store if required
Instead of requiring custom events and the $emit
functions on every component, and trying to keep components and child components up to date, every part of your Vue app can update the central store, and others can react and update their data and state based on that information. It also gives us a common place to store data so, rather than trying to decide whether...