difference between function and component in react code example

Example 1: react functional components

const component = () => {
console.log("This is a functional Component");
}

Example 2: difference between React.functioncomponent and React.component

import React, { Component } from "react";

class ClassComponent extends Component {
 render() {
   return <h1>Hello, world</h1>;
 }
}

Example 3: difference between React.functioncomponent and React.component

import React from "react";

class ClassComponent extends React.Component {
 render() {
   return <h1>Hello, world</h1>;
 }
}

Tags:

C Example