I understand the difference between a functional component and a class component, but what's the difference between const component to a functional component?

e.g

const Home = () => {return (<div>Home</div>)}

To

function Home() {return (<div>Home</div>)}

Both of them can use hooks, so what's the main difference?

1

Best Answer


There is no effective difference. First is creating a function using Arrow function expressionssyntax and storing it to a constant and the second is creating a plain function.

Both are functions that will perform the exact same task, return the component JSX code for rendering.

Also, there is no such term nor concept "Const Component"; there are "Functional Components" and "Class Components".