How it works...

A component is extremely similar to a Vue instance. Here, I am quoting from the official documentation:

In Vue, a component is essentially a Vue instance with predefined options.

As a matter of fact, even the anatomy of declaring a Vue instance is quite similar to declaring a Vue component. Let's put them side by side and identify the similarities and differences:

Vue.component('light-bulb', {     template: `     <div class='light-bulb'>       <p>Eureka!</p>     </div>     `   })
new Vue({     el: '#app'   })

The first thing you should note is the option objects present in both. While it contains only the template option in the lightbulb ...

Get Vue.js 2 Cookbook 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.