when to make react component vs react function code example
Example 1: difference between React.functioncomponent and React.component
import React from "react";
const FunctionalComponent = () => {
return <h1>Hello, world</h1>;
};
Example 2: difference between React.functioncomponent and React.component
import React, { Component } from "react";
class ClassComponent extends Component {
render() {
return <h1>Hello, world</h1>;
}
}