Skip to main content
D
React
React Components

React Components

Components act like custom HTML tags in React.

Read Time
5 min read
Difficulty
Beginner
Last Updated
Jun 15, 2026
Version
v1.0.0

Introduction

Components are independent, reusable pieces of a website, like a navigation bar or a button. Developers write a component once and use it everywhere. Modern React relies heavily on functional components.

Example

Example
1/* this creates a component */
2function Greeting() {
3  return <h2>Welcome to the website!</h2>;
4}
5
6// Usage: <Greeting />

Key Points

  • Components always start with a capital letter.
  • They return JSX code to render on the screen.
  • Functional components are the standard approach.
  • Class components are the older, outdated method.

Up Next

Continue your journey with the next topic.

Go to React Props