DEV Community

Discussion on: What makes you think "Ok, that should be a component"?

Collapse
 
itsjzt profile image
Saurabh Sharma

If you have to write it twice extract it into component.

This works most for us since we already have lots of style components (polaris)

Collapse
 
vtrpldn profile image
Vitor Paladini

I see. I also follow that rule sometimes but I'm actually pretty comfortable duplicating code if the right abstraction is still not clear to me. I'd much rather have simple, easy to understand duplicated code than an over-engineered component for instance.

Collapse
 
itsjzt profile image
Saurabh Sharma • Edited

Yeah, it makes sense. Duplication is better than sloppy abstraction