Reputation: 361
In terms of React performance which would be better alternative, use a single big stateless components or split in multiple statless components. By example I have a Post component to render a single post that won't change and it have some parts (title, cover, body).
Please explain your answer, in an easy way.
Upvotes: 2
Views: 1488
Reputation: 6027
Regarding the performance: the lightweight components are better since render will be done only for the component that changed, not the entire left side's Post.
I also agree with @Kerry Gougeon comment about reuse and maintenance. Forget about the slight performance difference, implementing the left side is bad for maintenance, it is much easier to test the lightweight components: when you have a problem it will be much faster to find it. Read this: https://reactjs.org/docs/thinking-in-react.html.
Upvotes: 1
Reputation: 4498
Small components hands down.
First and foremost, they are easier to test. Secondly, they are easier to reuse. Thirdly, it is good to get in the mindset that components are very lightweight. This is one of the main points of React. Small lightweight reusable components.
Upvotes: 1
Reputation: 169
Well These are the reasons according to me :
This is a great article if you want to understand more in detail
Upvotes: 4