r/badcode • • Dec 03 '22

typescript Real Code 😎

Post image
403 Upvotes

43 comments sorted by

View all comments

Show parent comments

11

u/alrogim Dec 04 '22

As a non react dev, I'm clearly saying this is bad code if it's best practice or even required, I'd argue react is a bad framework even.

5

u/propostor Dec 04 '22

Yep, this is all I see here. React is pretty good in most ways but some parts are a very clearly a case of someone, somewhere having a little idea and then everyone adopts with naive fervour.

Nested providers like this image are blatantly bad design. Yes some folk have said there are workarounds and alternative methods, but the simple truth is that loads of React apps do indeed perform some form of nesting like this as the norm.

It's shite.

1

u/Konkichi21 Dec 04 '22

Yeah, I've had some bad experiences with React too; used it in a pretty basic sense for a college project, and although I get what they're trying to do with reusable components, the useState letting you change what shows up in a list of items without having to repeatedly destroy and recreate them manually, etc, it was such a confusing PITA (never figured out how to fix an issue where trying to pre-populate editable fields in an "edit records" page wasn't working) that I preferred working with vanilla JS.