8 ms·
IMHO this is an anti-pattern. This involves people writing giant blocks of JSX that are hard to read. Especially with && all over the place. Just split up your
by LAC-Tech 5y ago
IMHO this is an anti-pattern.
This involves people writing giant blocks of JSX that are hard to read. Especially with && all over the place. Just split up your component into smaller components with max one conditional each.
Related, can anyone tell me the origins of the bizarre react practice of one file per component? I'm assume some mega corp told people it was "best practice", but the end result is way too many files with hard to read components.
- conradludgate 5y agoI'm assuming it dates back to class components and Class per File ideologies
- LAC-Tech 5y agoInteresting! And yeah Class per file had the exact same problem - classes were big and did too much. And now everyone hates "OO"
- esperent 5y agoThe ideas described here are just tools and the article contains plenty of simple and readable examples of the tools being used well. If you end up using them to create giant unreadable blocks of JSX then you're using the tools wrong, but that doesn't make the tools themselves an anti-pattern. The anti-pattern there is "giant unreadable blocks of code".