JSX and Components

Function components

Create reusable UI functions.

8 minutes - Beginner to intermediate

What this means

A function component is a JavaScript function that returns JSX. Component names should start with a capital letter, such as ProfileCard or LessonTitle.

In beginner terms, this topic answers one practical question: "What should I write, and why does React care about it?" Do not try to memorize the syntax first. First understand the idea, then connect the syntax to that idea.

Why it matters

Components let you name a piece of UI and reuse it. When a page grows, these names help you understand the screen faster.

When you build real React screens, this idea helps you decide where data should live, what the user should see, and what should happen after an interaction. That is why this lesson is part of the main path instead of being an optional detail.

Step by step

1. Notice the UI problem this topic solves. 2. Look at the smallest possible example. 3. Change one value and predict what should appear. 4. Run the example and compare the result with your prediction. 5. Use the practice task before moving on.

Small example

function LessonCard() {
  return <article>React basics</article>;
}

Common mistake

Do not start custom component names with lowercase letters. React treats lowercase JSX tags as built-in HTML elements.

Practice task

Create a component named ProfileCard that returns your name and one sentence about what you are learning.

Remember this

Capitalized functions become React components.

try.it

Examples

Try it: Function components

Edit this focused React example and run it in the browser preview.

Preview runs React in a sandboxed browser frame, never on the server.

react

editor

preview

Preparing preview...

practice.next

Practice before moving on

check.understanding

Lesson quiz

Login to save progress

You can read lessons without an account, but progress requires login.

Login