DEV Community

Aman Kureshi
Aman Kureshi

Posted on

🧱 What is a Component in React?

A component is a reusable piece of UI in React. You can combine multiple components to build a complete application

πŸ“˜ Example:

function Greeting() {
  return <h1>Hello, Developer!</h1>;
}
Enter fullscreen mode Exit fullscreen mode

You can use it like this:

<Greeting />
Enter fullscreen mode Exit fullscreen mode

✨ Key Points:
β€’ Components are reusable
β€’ Help keep code organized and modular
β€’ Can be functional or class components

React apps are basically a tree of components working together. πŸš€

Top comments (0)