© Brett Nelson 2018
Brett NelsonGetting to Know Vue.jshttps://doi.org/10.1007/978-1-4842-3781-6_8

8. Using Components

Brett Nelson1 
(1)
Eagan, Minnesota, USA
 

It’s not usually a good idea to get all your apps into one JavaScript file. With Vue we can use components to create reusable portions of our app and make it easier to maintain. In this chapter, we will learn how to create and use a custom Vue component, share data with components, use events, and use slots.

What Is a Component ?

You might be wondering what a component is and why you should care. Both those questions are good things to figure out.

A component in the sense that we are going to be exploring is a custom element that we can define and reuse. We will define our components as little ...

Get Getting to Know Vue.js: Learn to Build Single Page Applications in Vue from Scratch 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.