React Class Components

Last Updated : 3 Oct, 2025

Class components are ES6 classes that extend React.Component. They allow state management and lifecycle methods for complex UI logic.

  • Used for stateful components before Hooks.
  • Support lifecycle methods for mounting, updating, and unmounting.

The render() method in React class components returns JSX elements describing the UI of the Application.

Here is a simple class component in React

JavaScript
// Filename App.js
import React from "react";

class App extends React.Component {
    render() {
        return <h1>GeeksForGeeks</h1>;
    }
}

export default App;