DEV Community

Discussion on: A Tip to Make Your React Code Better and Cleaner

 
muni profile image
Muni Perez

Sure.

Also, I would like to add that having a big number of components is not bad. If you need to have many components, you will have them and that's just fine. What is bad is having unnecessary components. However, having fewer components can also be bad.

Instead of attaching to the number of components, you can think about one of the main principles of component philosophy. Is it breaking the single responsibility principle? Then it's time to break it up in smaller pieces. That's the basic thing and you can't go wrong with that ;) Large scale enterprise applications will have thousands of components.

Making it "inconvenient" for adding new components, in my opinion, is not beneficial for scalability. Create just the components that you need, not more, not less.