'React function or class component? [duplicate]

I've recently been using react.js to develop web interfaces for my projects. I never understood what is the difference between creating a component with a function and creating a component with a class. what is the difference?

function:

const Component = () =>{
    return(
        <div>

        </div>
    )
}
export default component

or class:

class Component extends React.Component {
    render() {
        <div>

        </div>
    }
  }
export default Component


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source