Component registration in Vue.js

You can register component in Vue.js in two ways
1 Global registration
2 Local registration

First, we will see global registration

Thi is the Vue code which creates the global component with the template

Then let us see the local registration of component
If you register component locally then it is available for that instance or component. You can use the component instance option of Vue

Now you can render the component in your html

Component template should have single root element
So following code does not work

Insted, you can use the following code

You can reformat the above code with backslash to improve the redability

Component should have its own data property