0

I am pretty new to react/react-native and want to develope my first app. During programming I saw that there are two diffrent ways to declare a component. As I understood I always have to use class-components, if I want to access state variables. But according to the react documentations it is also possible to access state variables via useState inside functional-components and now I do not rly know what to use as best practice.

Is there some sort of rule set or coding patterns on when to use class- and when functional-components?

Thank you very much in advance!

HiaslNeu
  • 11
  • 2
  • functional components + hooks is the "suggested" way, but you can still use class components, it's not like that's wrong – Syder Jan 21 '21 at 17:25
  • I think [this](https://stackoverflow.com/questions/38926574/react-functional-components-vs-classical-components) should answer your question. – Jan Bellenberg Mar 21 '21 at 13:41

0 Answers0