December 2017
Beginner to intermediate
376 pages
7h 53m
English
The ListingSave component does not have any local data; we will instead keep any saved listings in our Vuex store. To do this, we will create an array in the store called saved. Each time the user toggles the saved state of a listing its ID will be either added or removed from this array.
To begin, let's add a state property to our Vuex store. This object will hold any data we want to be globally available to the components of our app. We will add the saved property to this object and assign it an empty array.
resources/assets/js/store.js:
...export default new Vuex.Store({ state: { saved: [] } });
Read now
Unlock full access