May 15 2026
components are mainly 2 types:
*1. Function compoents *
A Functional Component is a simple JavaScript function that returns JSX.
It is the modern and most commonly used component type in React.
function Welcome() {
return <h1>Hello React</h1>;
}
export default Welcome;
2. Class Component
A Class Component is a React component created using an ES6 class.
It extends React.Component and must contain a render() method that returns JSX.
import React, { Component } from "react";
class Welcome extends Component {
render() {
return <h1>Hello Vignesh</h1>;
}
}
export default Welcome;
Top comments (0)