Answer the question
In order to leave comments, you need to log in
Why do many people abandon class components in favor of function components?
At least, this is the impression. Reading articles on React on Medium or somewhere else, very often I come across in them such an idea "leave components on classes in the past. Use only functions". Or even "redesign your projects from classes to functions - the effort will be worth it." I see the same thing in Vue.
The authors give examples and show why functions are more convenient than classes. And, like, with this everything is clear. But here's what's not clear. Why, then, were functions not originally used to create components? I often see examples from 2 or more years ago, and in all these examples, the components are built on classes.
I'm new to React, so I don't know how it has changed over the course of development. But I would like to understand what is causing this trend. Trend change? Or the ability to create components on functions was added to React relatively recently. If this is a new feature, then what was the difficulty in introducing functional components initially?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question