Hacker News new | ask | show | jobs
by Izkata 22 days ago
> At least AI tends to be smarter about React intricacies even if it does create huge files.

Oh no it's not. You just haven't seen where it goes when barely supervised by someone new to React. I've seen a level of spaghetti code with excessive useEffect and useMemo, reinventing two-way binding, I didn't even know was possible in React.

Spent months detangling weeks of AI-generated work earlier this year. Eventually got to the point we were actually fixing bugs by accident that previously neither they nor the tool could figure out.

1 comments

I feel like I've seen people frequently doing the mistake of keeping way too many things in state that could and should be computed, but instead they would useEffect to read to dependencies change to update the state. And frequent useEffect infinite loops. I guess it depends heavily on how you would set up the initial prompts I suppose, but yeah if someone is new to React, maybe AI will do that you are right.

But also I see people constantly baking in more and more stuff into a single component and more and more useEffects and convoluted stuff, without no one ever daring or deciding to split up the file, because it doesn't seem like part of the ticket. And it never will.

At least to AI I can set guardrails and rules/logic to follow, to keep files small, but many people working on many random things one small ticket a time, where no one is there doing the refactor, things will also get crazy.

At least I feel I can use AI with guardrails to keep the codebase in a better shape than 100s of people working on the same monorepo.