How should component classes be named?


#1

Question

How should component classes be named?

Answer

In addition to using UpperCamelCase to name component classes, there are a few other suggestions that you may consider when naming component classes.

Firstly, it can be important to name components in a meaningful and understandable way, such that the names reflect their purpose. This applies not only to React, but to any other classes and objects you name in a program.

In addition, to keep the files organized, it is good to keep only one component per file, and name files after the component they contain. So, if you named your file board.js, then the contained class is most likely named Board. This may not always be applicable, such as if a component is declared in the app.js file, however.