In 2021 should I start learning react using class component or no need now and start directly with function component? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

In 2021 should I start learning react using class component or no need now and start directly with function component?

6th Jan 2021, 2:48 PM
Moustafa Adel
Moustafa Adel - avatar
5 Respostas
+ 3
Start learning function components. As react hooks are pretty easy to implement and use less lines of code when compared to their class counterparts to achieve the same results. But you should also know class components because most of the applications when written were written mostly using class components and not everyone is rewriting them using function components. I am a beginner myself so you could wait on someone who has more experience to share their thoughts.
6th Jan 2021, 7:48 PM
Avinesh
Avinesh - avatar
+ 2
For new project, always use functional components.
7th Jan 2021, 12:46 PM
CalviÕ²
CalviÕ² - avatar
0
I would suggest learning both. Obviously, function components in React are more efficient and simple, but class components can still be used, depending on the situation.
6th Jan 2021, 3:09 PM
Jianmin Chen
Jianmin Chen - avatar
0
Thank you all.
7th Jan 2021, 1:10 PM
Moustafa Adel
Moustafa Adel - avatar
0
One last thing what is the difference is it only the keyword this in the state or the whole thinking and coding is different from using functions?
7th Jan 2021, 1:11 PM
Moustafa Adel
Moustafa Adel - avatar