Class Components
-
Class-based Components uses ES6 class syntax. It can make use of the lifecycle methods.
-
As you can see in the example that u have given above Class components extend from React.Component.
-
In here you have to use this keyword to access the props and functions that you declare inside the class components.
Functional Components
-
Functional Components are simpler comparing to class-based functions.
-
Functional Components mainly focuses on the UI of the application, not on the behavior.
-
To be more precise these are basically render function in the class
component. -
Functional Components can’t have state (without hooks) and they can’t make
use of lifecycle methods.