I want a use case example of when react class components are needed for a project over a react functional component and vise versa. I cant seem to understand the difference between the two.
Asked
Active
Viewed 544 times
0

Henry Ecker
- 34,399
- 18
- 41
- 57

ROSBY ASIAMAH
- 5
- 1
-
Class components are discouraged now after hooks has been added – Konrad Oct 09 '22 at 23:19
-
1Some threads: [what is the difference between functional component and class component](/q/35953840), [React functional components vs classical components](/q/38926574), [When to use ES6 class based React components vs. functional ES6 React components?](/q/36097965) – Henry Ecker Oct 09 '22 at 23:23
1 Answers
0
It’s mostly historical. React components were originally all class components. Function components were introduced in a later version of React. Going forward you should use function components.

ray
- 26,557
- 5
- 28
- 27