A Short Guide to Component Naming

par Angela Fisher, Front-end Developer

1. Brevity is Key

Time is scarce, don’t waste it typing out long, descriptive component names. One approach is to give them short, cryptic names that only you will understand.

Need a button? Call it "btn". A modal? How about "md"? You’ll save precious minutes per day and you’ll get the added benefit of being the only person in the codebase who knows where anything is. This is called job security.

2. Rank High in Search

When working in large repos with lots of collaborators, it’s important that your component ranks high when people search for anything.

One way to stand out is to include all the possible search terms in your component name. Instead of “SignInButton” you might want call it “SignInButtonAuthenticationCookieUserLogIn” which will ensure that it is returned in almost any related search result.

3. Mix Languages

If you work remotely, it’s likely you are on a global team and yet all your components have English names. This slows down your non-english colleagues considerably so you should allow them to use their native tongue when naming components.

You can create an index file that maps all the different languages within your repo. Need a dropdown? Look for “Desplegable”. A form? Search “Форма”. You’ll learn multiple new languages while being more inclusive to your colleagues.

Plus d'articles

Comment bien rédiger un article pour le web en 2023 ? Guide pour le SEO et Google

Dans le monde numérique en constante évolution, il est essentiel de maîtriser les techniques de rédaction pour le web afin de créer un contenu optimisé pour les moteurs de recherche tels que Google.

En savoir plus

L'avenir du développement Web : nos prévisions pour 2023

Explorons les dernières tendances en matière de développement Web et régurgitons certaines prédictions que nous avons lues sur Twitter sur la façon dont elles façonneront l'industrie au cours de l'année à venir.

En savoir plus

Dîtes en nous plus à propos de votre projet

Nos coordonnées

  • Florian Dupuis
    +33 6 51 69 80 21
  • Olivia Garlantézec
    +33 6 98 69 03 91