3 ms·
I'm curious why the top is preferred over the bottom: Open elements on the same line. The 80-character line limit is a bit tight, so we opt to conserve the ex
by cnp 11y ago
I'm curious why the top is preferred over the bottom:
Open elements on the same line.
The 80-character line limit is a bit tight, so we opt to conserve the extra 4.
Yes:
return <div>
...
</div>;
No:
// "div" is not on the same line as "return"
return (
<div>
...
</div>
);
The latter I feel is much more readable and clear than the former, as it has a certain symmetry and cohesion that you find in normal html. The top one seems to be break readability. Wondering if anyone can comment on this specific decision?
- xanderjanz 11y agoTheir logic is that because elements are typically deeply nested, it's better to sacrifice the readability for the saved indentation. By the time you get 4 child elements deep, almost half your line space goes to tabs.