Chapter 6. Understanding Vuex

 

This chapter covers

  • What Vuex is
  • What state means
  • How to use Vuex in a project

Vuex is a large topic. Before you learn how to test Vuex in an application in chapter 7, you need to understand the fundamentals of it. In this chapter, you’ll learn what Vuex is and how it makes it easier to manage data in an app.

Note

If you’re already familiar with Vuex, you can skip ahead to the next chapter.

As an app grows in size, so does the data that the app uses. Making sure data stored in different components stays in sync is challenging and can lead to difficult-to-track bugs. Vuex is the solution to that problem.

Vuex is described as a state management library. That description isn’t useful if you don’t know what state means, so the first section of this chapter is about understanding state in the context of a Vue application.

Note

If you’ve used Redux before, a lot of the Vuex concepts will be familiar to you. The main difference between Vuex and Redux is that Vuex mutates the store state, whereas Redux creates a new store state on every update.

After you understand what state is, I’ll explain to you the problem Vuex solves. Finally I’ll teach you the technical details of Vuex—what a Vuex store is and what parts make up a Vuex store.

First, you need to understand state.

6.1. Understanding state

6.2. The problem Vuex solves

6.3. Understanding the Vuex store

Summary

sitemap