0

What are the rules for naming components in Reactjs?

I am aware that component names must start with a capital letter, but what else?

What I'd like to do is namespace the components of my PP library, for example have all the names start with "PP_" or "PP.".

I use JSX, in case that makes a difference.

Christophe
  • 27,383
  • 28
  • 97
  • 140
  • Other than react component names being PascalCased, I believe the rest fall under plain old vanilla JS identifier requirements/restrictions. – Drew Reese Sep 15 '20 at 18:49
  • [related old docs](https://legacy.reactjs.org/docs/components-and-props.html#rendering-a-component), which state: "_Note: Always start component names with a capital letter. \[...\]_" – starball May 14 '23 at 19:08

1 Answers1

2

There is no official style guide for naming react components. Most of the people follow pascal-case. Below is the link of popular airbnb style guide. https://github.com/airbnb/javascript/tree/master/react#naming

SathwikaRao
  • 133
  • 1
  • 8