DEV Community

Discussion on: React: Class Component VS Function Component with Hooks

Collapse
 
tian3401 profile image
tian3401

Hey Danielle! Had a quick question for you. Now that hooks have brought state to functional components, beside concision why would someone use a class component over a functional component?

Collapse
 
danielleye profile image
Danielle Ye

Hi Tian,
In my understanding, class components can be replaced by functional components with hooks. But for some old projects, they are still using class instead of rewriting the whole project.
Also as react team said, they won't stop supporting for class but they suggest trying hooks on new projects. Check this on react docs 👉🏻: reactjs.org/docs/hooks-intro.html#...