Using the Vuex store in the shopping list application

I hope you still remember the challenge we were facing at the beginning of this chapter. We would like to establish communication between the components in such a way that it would be easy to change the title of the shopping lists from the ChangeTitleComponent and propagate it to both ShoppingListTitle and ShoppingListComponent. Let's remove the hardcoded array of shopping lists from App.vue and copy it to the store's state:

//store.js 
<...> 
const state = { 
  shoppinglists: [ { id: 'groceries', title: 'Groceries', items: [{ text: 'Bananas', checked: true }, { text: 'Apples', checked: false }] }, { id: 'clothes', title: 'Clothes', items: [{ text: 'black dress', checked: false }, { text: 'all-stars', ...

Get Learning Vue.js 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.