DEV Community

Discussion on: Do you still use React classes?

Collapse
 
sfiquet profile image
Sylvie Fiquet

I'm writing new code with hooks. My old projects still have classes. They work perfectly fine, why waste time changing them? In general I'd only convert working code when the benefits outweigh the cost.

I've never really liked having two types of components. I've had several cases when adding a new functionality meant moving the state up or down the hierarchy. Refactoring a class component into a function component (or vice versa) is a pain. At least with hooks it's not an issue anymore. I'm not 100% comfortable with the magic behaviour that come with hooks but I like having code that refactors easily.