I avoid declaring React components via the concise arrow syntax


I avoid declaring React components via the concise arrow syntax.

Instead, I prefer to use plain old function declarations.

Here's why:
1. I can set a debugger inside a function declaration.
2. I can export default on the same line as the declaration.

#react

A nice third benefit I should have mentioned: Function declarations are hoisted. So if multiple components are declared in the same file, the order they're declared doesn't matter. 😎

View original on X