3 ms·
The article’s format is a bit confusing here. I think what you’re reacting to _is_ the “alternate hacky approach”. Just one line up in the bulleted list is: “B
by harlanlewis 9y ago
The article’s format is a bit confusing here. I think what you’re reacting to _is_ the “alternate hacky approach”.
Just one line up in the bulleted list is: “Best approach: Move logic to sub-components“. There isn’t an example or a link because the recommendation is that simple.
Of course there are no absolutes and there are many other approaches that split difference between inline logic and additional components, but the general idea is to avoid writing a bunch of conditionals in your JSX unless you have to - and in that case, this mess of nested ternaries is one way to do it.