Your comparison doesn't even relevant to each other. If you want, I can write that class component 6 lines less than your codes above. The main different points between class component and functional component using hooks is:
Class component give you power to control your states/props with lifecycle and "this" (and yes, componentDidMount and componentDidUpdate are not equal to useEffect).
Methods inside functional component will be re-declaring if that component is re-render, which affect your web application performance.
Class component has steep learning curve. Functional component heading to an easy development experience for newcomer. For fast coding I will recommend using functional component. But if you need advance ways to approach the solution, for example, control animation in React Native app, or handle difficult logic, use class component.
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.
Your comparison doesn't even relevant to each other. If you want, I can write that class component 6 lines less than your codes above. The main different points between class component and functional component using hooks is: