I can't help but wondering if there's any advantage between using plain functions and fat arrows for React functional components
const MyMainComponent = () => (
<main>
<h1>Welcome to my app</h1>
</main>
)
function MyMainComponent() {
return (
<main>
<h1>Welcome to my app</h1>
</main>
)
}
Both work of course perfectly fine but is there a recommended way to write those ? Any argument in favor of one or the other ?
Edit: I am aware of the differences when it comes to plain javascript functions (i.e. context, stack trace, return keyword, etc.) that can have an impact for the kind of use you have for functions. However I am asking the question purely in terms of React components.