The main advantage of function components over class components is code collocation. You can have all code for a given feature in one block of code and not spreaded over different lifecycle methods. When you need to use a feature in more than one component, you can just create a custom hook with all the code needed for a given feature.
The easiest way to differentiate between the two is that class components use classes and function components use functions (the hint is in the name ;).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The main advantage of function components over class components is code collocation. You can have all code for a given feature in one block of code and not spreaded over different lifecycle methods. When you need to use a feature in more than one component, you can just create a custom hook with all the code needed for a given feature.
The easiest way to differentiate between the two is that class components use
class
es and function components usefunction
s (the hint is in the name ;).