r/badcode • u/mrbraises • Jun 02 '23
js elt nesting for more readability <3 (there is another ternary + map on top of this but it's 300 lines above this)
146
Upvotes
r/badcode • u/mrbraises • Jun 02 '23
13
u/annoyed_freelancer Jun 02 '23
Whoever formulated this should be beaten with a stick. Event stuff like proper
if/elseor wrapping{}on lines 2 and 3 would boost readability.17
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Jun 02 '23
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
33
u/[deleted] Jun 02 '23
typical React code ^^
10
u/HoratioWobble Jun 02 '23
There's a special place in hell for people who put excessive logic or multiple conditions in JSX.
If it can't be done with a short circuit it should be a separate function, or component
5
u/thepurpleproject Jun 02 '23
we have plenty of devs in our team who code like this on UI
just keep adding nested checks and loop everywhere...it's so harder to read and fix