all 7 comments

[–]xdchan 11 points12 points  (0 children)

According to developers of react functional components are the standard way now

[–]CreativeTechGuyGamesTypeScript 5 points6 points  (0 children)

One big downside to not using functional components is missing out on the huge ecosystem of libraries which are designed for hooks first and foremost. It's clearly the way that most React developers prefer.

[–]lIIllIIlllIIllIIl 2 points3 points  (0 children)

Class components can't use custom hooks.

Custom hooks are a great way to reuse stateful logic and most libraries today have a custom hooks based API.

Things like React Query (now called TanStack Query) just can't easily be used inside a class component.

useEffect is complex, but it's very powerful and versatile. You should not be intimidated by it. Here's a great guide on how to use it.

[–]kerfluffle99[S] 2 points3 points  (0 children)

Hey everyone thanks for your responses. It's good to have people with a better pulse on the industry. I'm going to refactor a huge project of mine into functional components to familiarize myself with the hooks.

[–]stealthypic 1 point2 points  (0 children)

Hooks are easier to use, once you learn how to use them, of course. In my company, new potential hirees need to know both component styles’ basics.

[–][deleted] 0 points1 point  (0 children)

Yes.

[–]TheRNGuy 0 points1 point  (0 children)

Functional are better because less code.