React components are more than just functions or classes—they are the building blocks of modern UI engineering. They encapsulate structure, behavior, and presentation into isolated modules that can be composed into sophisticated interfaces. This article examines how components work, why they matter, and how to write them effectively.
What Exactly Is a Component?
A component in React is a self-contained unit of UI. It defines what should appear on the screen and how it should behave when data changes.
A component typically includes:
- A rendering definition (via JSX)
- Optional logic
- Optional state
- Optional lifecycle behavior (in function components, via hooks)
In essence, a component is a function that transforms data into UI.
Two Primary Types of Components
- Function Components These are JavaScript functions that return JSX. They are the modern standard and support hooks for managing state and side effects.
- Class Components These use ES6 classes and lifecycle methods. They are still supported but no longer recommended for new code.
Function Components: The Modern Approach
Function components are concise, expressive, and align with React’s functional programming philosophy.
function Greeting({ name }) {
return <p>Hello, {name}</p>;
}
export default Greeting;
Key Characteristics
- They accept props as arguments.
- They return JSX that describes the UI.
- They can use hooks for state and effects.
- They are easier to test and reason about.
Class Components: The Legacy Approach
Class components were the original way to manage state and lifecycle events.
import React, { Component } from "react";
class Greeting extends Component {
render() {
return <p>Hello, {this.props.name}</p>;
}
}
export default Greeting;
Why They’re Less Common Now
- More verbose
- More complex lifecycle model
- Hooks provide a more flexible alternative
Class components remain important historically, but function components dominate modern React development.
Props: The Data Pipeline of Components
Props (short for “properties”) are how components receive data from their parent.
They are:
- Read-only
- Passed down the component tree
- Used to make components reusable and configurable
Example:
<Greeting name="Ore" />
Inside the component:
function Greeting({ name }) {
return <p>Hello, {name}</p>;
}
Props allow components to be dynamic without managing their own state.
Composition: How Components Work Together
React encourages composition over inheritance. This means you build complex UIs by combining smaller components.
Example:
function Profile() {
return (
<section>
<Avatar />
<UserDetails />
</section>
);
}
Each component handles a specific responsibility, making the system easier to maintain.
Why Components Matter
Components provide:
- Reusability Write once, use anywhere.
- Isolation Each component manages its own logic and UI.
- Predictability Clear data flow makes behavior easier to understand.
- Scalability Large interfaces become manageable when broken into smaller parts.
React’s component model is one of the reasons it became the dominant UI library in modern web development.
Sources & Further Reading
- React Components Overview:
https://react.dev/learn/your-first-component(react.dev in Bing) - Props Documentation:
https://react.dev/learn/passing-props-to-a-component(react.dev in Bing) - Component Composition:
https://react.dev/learn/passing-props-to-a-component#passing-jsx-as-children(react.dev in Bing)

