Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
222 views
in Technique[技术] by (71.8m points)

reactjs - React-Native: When to use Class- or Functional-Components?

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!

question from:https://stackoverflow.com/questions/65832589/react-native-when-to-use-class-or-functional-components

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...