Skip to content
the poor coder

vue component naming convention

Poor Man
Published
Reading time
1 min read
On this page

Vue Component Naming Convention#

When it comes to naming Vue components, there are a few conventions that developers commonly follow. The most popular one is the PascalCase convention, where each word in the component name starts with a capital letter. For example, a component that displays a user profile could be named UserProfile. This convention is commonly used because it makes it easier to read and understand the component names.

Another convention is the kebab-case convention, where each word in the component name is separated by a hyphen. For example, the same user profile component could be named user-profile. This convention is commonly used in HTML and CSS, and can help make components more consistent with other web technologies.

PascalCase Example:#

Text

    <div id="app">
        <UserProfile />
    </div>

Kebab-case Example:#

Text

    <div id="app">
        <user-profile />
    </div>

It's worth noting that Vue also has its own naming conventions for certain types of components. For example, single-file components should always use PascalCase, while DOM components should always use kebab-case.

Ultimately, the naming convention you choose is up to you and your team. However, it's important to be consistent with your naming conventions to make your code easier to read and maintain.

Keep going

2023

how to sort an array

How to Sort an Array If you have an array and you want to order its elements in a specific way, you need to use a sorting algorithm. There are several sorting algorithms available, but two of the most commonly used are…

javascript2 min read
2023

jquery mobile or desktop

jQuery Mobile or Desktop? As a web developer, I have had some experience with both jQuery Mobile and jQuery Desktop. Both frameworks have their pros and cons, and which one to use really depends on the specific project…

javascript1 min read
2023

node.js folder structure

Node.js Folder Structure If you are new to Node.js, it can be daunting to create a folder structure that will work for your project. The structure you choose will depend on the size and complexity of your project. Here…

javascript1 min read
ESC