From the course: Building Laravel and Vue.js 2 Web Apps

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using the mapState helper

Using the mapState helper

From the course: Building Laravel and Vue.js 2 Web Apps

Start my 1-month free trial

Using the mapState helper

- In this video we'll take a quick look at a useful helper method in view X. In the menu item component, we'll need to switch from using this initial categories prop, to using the computed categories property. So I'm just going to copy that from category manager and place it down here below data. Up in this drop down where we iterate through the categories to create the options, we'll need to change this to categories, but not all of your applications state always needs to be managed in the store. We may not find that there's much of a payoff from moving the item data into view X. We can load it in our created hook and save it in the save method without worrying too much about how it might affect other components, since for example, the menu item list has it's data fed from the server each time we look at it, so we don't have to worry about things being out of sync or worry about it being difficult to trace the data as it moves through the application. But one thing I want to look at…

Contents