I have built this code:
const example = () => {
console.log("test");
}
function example() {
console.log("test");
}
Seeing as their output and use are identical, is there any significant difference between the two?
I have built this code:
const example = () => {
console.log("test");
}
function example() {
console.log("test");
}
Seeing as their output and use are identical, is there any significant difference between the two?
The only thing i could find is about Hoisting, if you use some component before declaring it, you should use function so your linter wouldn't throw an error.
Like this
const App = () => (
<>
<MyComponent />
<AlsoMyComponent />
</>
)
// I like to keep my components at the bottom
function MyComponent() {}
function AlsoMyComponent() {}
Check this out: https://dev.to/ugglr/react-functional-components-const-vs-function-2kj9