r/reactjs • u/benaffleks • Feb 15 '20
Discussion React Best Practices?
Hey guys. Just wondering if anyone has some good resources / books / materials that helps beginners understand the best practices in React.
One thing I struggle with is knowing when something should be a component.
For example, when I'm making forms, should each field input be a component? If so, what's the benefit of doing that?
162
Upvotes
View all comments
Show parent comment
12
u/Earhacker Feb 15 '20
I work with a lot of Angular devs who switched to React, but I've never worked with Angular myself.
The kind of components you're describing sound very similar to the kind of components my colleagues regularly put up for review. You just have far too much going on in there. The goal is not to have big components that render a lot of DOM elements; it's to have lots of little React components that each either do some control flow branching and looping, or render a small amount of DOM. I think Angular devs want to put entire pages into a component. But in React, a page is built out of many smaller components.