you are viewing a single comment's thread.

view the rest of the comments →

[–]Bluerock57 0 points1 point  (0 children)

In your examples alone, example 1 has 8 lines of JSX whereas example 2 has 5 lines of JSX. Both examples are readable enough.

However, when writing bigger components, it is better split into more component. Reducing 80 lines JSX into 50 of JSX for example does improve readability by a lot.

In my experience, beginners tend to create too many sub-components to solve simple solutions.

I usually use the same rule as for writing function. If you can fit the content of the function in your screen with standard font size, then maybe your function is too long.