DEV Community

Discussion on: My beef 🥩 with Javascript and ReactJS ⚛️

Collapse
 
sabbin profile image
Sabin Pandelovitch • Edited

If you like interfaces you could try Typescript or Flow, there are solutions.

In my opinion, functional components are better because there is no lifecycle, hooks are way better. it's easier to test also. You can have pure function components, in class based you always extend another class. There is less code, and you have consistency, no mixins between classes and functions.

As for global states there are a few approaches to this, but the simplest way is by using the context hook, create a context and consume it anywhere in the app.

reactjs.org/docs/context.html

Collapse
 
dannyverp profile image
Danny Verpoort

Thanks for your reply Sabin! Which one would you personally recommend: typescript or flow. I've got a bit of experience with Flow but I find it a bit clunky. How steep is the learning curve on Typescript?

Collapse
 
sabbin profile image
Sabin Pandelovitch • Edited

Personally I use neither, I'm not a big fan of strict typing. I do understand what are the advantages on a larger scale...

Tried them both, both seemed kind of same as complexity... If I would to choose, I would choose Typescript, because it's not limited to react only. The support and community it's bigger and it has a wider spread across projects than flow.