25.06.2018 Views

Full-Stack Vue.js 2 and Laravel 5

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Managing Your Application State<br />

with <strong>Vue</strong>x<br />

In the last chapter, you learned how <strong>Vue</strong> Router can be used to add virtual pages<br />

to a <strong>Vue</strong>.<strong>js</strong> single-page app. We will now add components to <strong>Vue</strong>bnb that share<br />

data across pages <strong>and</strong> therefore can't rely on transient local state. To do this, we<br />

will utilize <strong>Vue</strong>x, a Flux-inspired library for <strong>Vue</strong>.<strong>js</strong> that offers a robust means of<br />

managing global application state.<br />

Topics covered in this chapter:<br />

An introduction to the Flux application architecture <strong>and</strong> why it is useful for<br />

building user interfaces<br />

An overview of <strong>Vue</strong>x <strong>and</strong> its key features, including state <strong>and</strong> mutations<br />

How to install <strong>Vue</strong>x <strong>and</strong> set up a global store that can be accessed by <strong>Vue</strong>.<strong>js</strong><br />

components<br />

How <strong>Vue</strong>x allows for superior debugging with <strong>Vue</strong> Devtools via mutation<br />

logging <strong>and</strong> time-travel debugging<br />

The creation of a save feature for <strong>Vue</strong>bnb listings <strong>and</strong> a saved listings page<br />

Moving page state into <strong>Vue</strong>x to minimize unnecessary data retrieval from<br />

the server

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!