Class-based component VS Functional Component with React

Have you always wondered about the difference between a component using a class and a component in the form of a function with React? Then this article is for you!
•
Updated on August 14, 2026
•
2 min read
Believemy logo

Have you always wondered about the difference between a class-based component and a functional component in React? This recap article is made for you!

 

Class-Based Component

This is the very first way to create a component, the origin of React.

JAVASCRIPT
import React from 'react';

class MyComponent extends React.Component {
    render() {
        return (
            <h1>Hello from my class-based component!</h1>
        );
    }
}

export default MyComponent;

 

Functional Component

We could also create functional components with React in the past, but we were limited by what we could do. That's no longer the case today; we'll discuss it further in upcoming sessions.

JAVASCRIPT
import React from 'react';

function MyComponent() {
    return (
        <h1>Hello from my functional component!</h1>
    );
}

export default MyComponent;

It's also possible to use functional components in the form of an arrow function:

JAVASCRIPT
import React from 'react';

const MyComponent = () => {
    return (
        <h1>Hello from my functional component (with the arrow function)!</h1>
    );
};

export default MyComponent;

 

Which Form to Use?

We will use these three forms, but we will focus on the functional form of a component in the future (whether with the keyword function or the arrow function). Don't worry, we'll go step by step in the rest of the training!

Category: Developers

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.

Believemy logo
Comments (0)

You need to be logged in to comment on this article: log in or sign up.

Read next

What are the differences between "props" and "state" with React?

Props... Properties... State... State... At first, it's always a bit... strange! To avoid any doubts, let's take a look at the differences between props and state in React.

December 9, 2024

Code faster with React using these techniques

Learn how to code faster with React thanks to simple but effective techniques used by experienced developers.

December 9, 2024

When should you use brackets with React?

To put brackets or not to put brackets... This can be a complicated subject when you're new to React! Let's find out together when to use brackets and when not to.

December 9, 2024

React vs NextJS: what should you choose for your project in 2025?

Which technology should you use, React or NextJS? Discover their advantages and disadvantages to choose the one best suited to your projects.

December 9, 2024

How do you manage forms in React?

Forms are essential elements of interactive web applications. Learn how to master controlled and uncontrolled inputs to deliver a seamless user experience. Discover best practices for simplified management.

December 11, 2024

Why you should learn React in 2025: all the benefits!

Explore why React remains a must-have choice in 2025 for developers. Discover its advantages, the evolution of its features and why the market continues to prefer it.

December 6, 2024

React vs Angular: differences, advantages and disadvantages in 2025

Find out which of React or Angular would be the best choice for your project by understanding their pros and cons in our comprehensive comparison.

December 9, 2024

React vs VueJS: which framework to choose in 2025?

Discover the differences between React and VueJS to choose the best framework for your project.

December 9, 2024

Become the solopreneur you dream of being.

First project, career change, business launch: access our courses, practice on real-world cases, and move forward with clear guidance.