Drag the edges to resize the window.

Code Editor
Learn
Your First React Component

Name a Component Class

Good! Subclassing React.Component is the way to declare a new component class.

When you declare a new component class, you need to give that component class a name. On line 4, notice that our component class's name is MyComponentClass.

Component class variable names must begin with capital letters!

This adheres to JavaScript's class syntax. It also adheres to a broader programming convention in which class names are written in UpperCamelCase.

In addition, there is a React-specific reason why component class names must always be capitalized. We'll get to that soon!

Report a Bug
If you see a bug or any other issue with this page, please report it here.