loading...

re: A Tip to Make Your React Code Better and Cleaner VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I second this, also I suggest looking react-hook-forms that make the same thing
 

Ahh Gotcha. I was going for more of an illustrative example to try to abstract away implementation details but didn't consider the fact of form validation. Thanks fellas!

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.

code of conduct - report abuse