const Test () => {}
// or
function Test() {}
export default Test
to export default () => {} syntax because of readability.
When you move your components around, say rename the file from Test.jsx to index.jsx for some reason, you have to dig thru code to see what it is for others.
You can use Class Components (CC) for handling error boundaries or to use life cycle methods not provided by Hooks (componentDidCatch & getDerivedStateFromError). CC isn't going away
but my personal opinion is that, FC with hooks seems to be where it's going (and I found FC w/ hooks much easier to write/reason about with shorter code).
For Function Components (FC) I prefer named functions
to
export default () => {}
syntax because of readability.When you move your components around, say rename the file from
Test.jsx
toindex.jsx
for some reason, you have to dig thru code to see what it is for others.You can use Class Components (CC) for handling error boundaries or to use life cycle methods not provided by Hooks (
componentDidCatch
&getDerivedStateFromError
). CC isn't going awaybut my personal opinion is that, FC with hooks seems to be where it's going (and I found FC w/ hooks much easier to write/reason about with shorter code).
Thank you for informing me