Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vue.js components capitalized

is there a specific reason for Vue.js components being capitalized?

I see this a lot but I don't see a valid reason for why there are written this way. Even the cli repositories have this for components.

like image 527
Stephan-v Avatar asked Mar 02 '17 14:03

Stephan-v


People also ask

How do I name my Vue components?

Component names should always be multi-word, except for root App components, and built-in components provided by Vue, such as <transition> or <component> . This prevents conflicts with existing and future HTML elements, since all HTML elements are a single word.

What are the 3 parts of a component in Vue?

Components in Vue are composed of three parts; a template (which is like HTML), styles and JavaScript. These can be split into multiple files or the same . vue file.

Is Vue js better than react?

Both of them show excellent performance and now are used for building popular web apps. In fact, Vue is better for building complex web apps than React.


1 Answers

It's just a convention to differentiate between the component constructor/definition (capitalised) and the component instances.

It's a common convention that classes are capitalised but instances of a class are not:

const user = new User()
like image 86
Linus Borg Avatar answered Oct 29 '22 08:10

Linus Borg