DEV Community

Discussion on: React functional components: const vs. function

Collapse
sargnec profile image
Sargnec

My component was not showing up const MyComponent = () => {...} bc of this and its not gives error or something I searched what I'm doing wrong and finally saw that if u use { } u have to use return otherwise (...) . Thank you

Collapse
doctorderek profile image
Dr. Derek Austin 🥳

That's a fantastic tip, and I've also been tripped up by that particular thing. You also sometimes need () around the JSX, though Prettier will add it for you. I wrote an article about this topic: javascript.plainenglish.io/how-to-...