0 votes
in ReactJS by
When to use a Class Component over a Function Component?

1 Answer

0 votes
by
If the component needs state or lifecycle methods then use class component otherwise use function component. However, from React 16.8 with the addition of Hooks, you could use state , lifecycle methods and other features that were only available in class component right in your function component.

Related questions

0 votes
asked Nov 26, 2019 in ReactJS by AdilsonLima
0 votes
asked Jan 31, 2021 in ReactJS by Robindeniel
...