Bad code is just bad code.

preview_player
Показать описание
#javascript #react
Рекомендации по теме
Комментарии
Автор

The author of the code does not know single responsibility principle

JuanGarcia-jjoh
Автор

I belive the day you realise bad code, a library idea is born.

intebuddy
Автор

As a JavaScript developer I blame the backend language and framework

geminimiller
Автор

Yeah, in my company we’ve like 100 state variables in one file.

I tried to tell my manager but all he cares about is functionality and tell me that’s all he cares about and it puts me in bad light like why’re you taking this much time and everything.

theIcemanYT
Автор

The funny thing is that this could happen on every frameworks or languages if dev decide to put 50 variables in the same function for some reason

OnFireByte
Автор

I'm sure author of the code has an additional state that counts how many items are in another state variable

vladimir_balaur
Автор

Narrator: "The state libraries were not in fact, great."

ilioscio
Автор

I was thinking "that has to be satire" then i realised it's an actual commit 😭

Ctrl_Alt_Elite
Автор

I always say “I hate React, not because it’s bad, but because it makes me feel dumb”

kyuss
Автор

Damn more than 100 lines of code in a single component is an automatic jail sentence for me

imheretosleep
Автор

I'm no techfluencer on Twitter or the CTO of anything but I wonder why he didn't return the PR with the following suggestions:

1. Do every single one of these state vars need to be updated separately?
2. If not, is it possible to merge most of them into one object?
3. Did you try useReducer?
4. Did you consider maybe refactoring all this logic to a custom hook?

React goes out of its way to help us avoid writing code just like this. This is probably a crazy business requirement or a skill issue

RexGalilae
Автор

I always say blocking the pipeline with as many code quality checks will force the developers to not write garbage code.

Mainly 2 checks,
No js or ts files should be more than 400 lines long

All imports in the component tested should be mocked in its relevant test file.

vickylance
Автор

It also feels like a lot of the state could go as derived states

devsami
Автор

Bad code is bad code but JavaScript is just JavaScript

Il_panda
Автор

You know how much prop drilling there's gonna be

labhamjain
Автор

Pretty sure you can create a mess like that almost anywhere

thatsalot
Автор

I always blame myself 😂 that's why i take a few extra tickets to optimize the already existing code into something that i don't hate (unless i don't have time constraints)

emilfilipov
Автор

Admittedly I've not had to handle massive amounts of states in a single component but you'd think some of those states could be wrapped into a common object and other probably shouldn't be there (should be extracted into other components)

theburntcrumpet
Автор

Separate into different hooks and use reducers

MizManFryingP
Автор

it's actually still readable and workable

josipX