0 votes
in ReactJS by

What are the differences between the Class component and Functional component?

1 Answer

0 votes
by

Ans.

ParameterClass ComponentFunctional Component
SyntaxThis component requests you to extend from React. Component to create render function that in turn returns a react elementIt is just a plain JavaScript function that accepts props as their arguments and returns the react element.
Life cycle hooksLifecycle hooks are created from the React Component. This class component makes lifecycle hooks available in it.We cannot use lifecycle hooks in a functional component.
ReadabilityThey are very difficult to test and readThey are much easier to test and read

Related questions

0 votes
asked Oct 9, 2019 in ReactJS by Indian
0 votes
asked May 2, 2021 in JAVA by sharadyadav1986
...