Just opening dev tools on MIT-written big tech corps and startups confirms nobody is able to write good websites or applications that arent filled with performance and memory leaks.
While I hate class component lifecycle methods they are much better than complex hook setups when solving more advanced problems.
I’m not exactly sure what complication you mean. Lifecycle method sucks, yeah, but you replaced them with lifecycle hooks. So the same mental overhead but now in a pseudo stateless functions, with state full escape hatches.
Hooks are IMO the best thing that happened to react.
Classes have inherent state, and methods which encapsulate logic. That pushed you to create separate logic bundles.
Functions are callable scripts. There are no rules. I’ve seen too many components that invoke tens of hooks, and hundreds of lines of state management. Most classes I’ve seen never reached that. Were there classes that were too big? Of course, but at least there was logic separation with methods.
You can have self documenting state like class components in the form of reducers which are just state machines. But it is much later in the documentation.
You are writing code for an object that is inherently stateful, in a stateless design pattern. Instead of embracing state, you crate escape hatches and plugins to tap into your state, and then more escape hatches inside those escape hatches to tap out.
It’s react rendering model leaking into your code. Let’s imagine react changes the rendering paradigm, and components are rendered once with only state updates. Almost all of your hooks become useless. The fact that you need to think about react internal every time you create a component is such a bad API choice that I’m amazed it still exists, and being expanded.
I guess so - but react could also change (and I think did at some point) how their class methods work, how often they're triggered, and when.
I don't understand the stateless comment - hooks are as stateful as you make them, using useState or useContext or any of the other ways of maintaining data between renders.
In class based components, you didn’t care how react works under the hood, except for the render method which is called by react. So the surface of code controlled by react was only what you included inside that method. In function components, the entire function is owned by the renderer, so you need to deeply understand how it works.
When everyone around writes shit code, you don’t care. In hooks, it becomes much more critical.
Vercel, the only thing they have going for the app model mess, are the partnerships with SaaS vendors that make them the must go tooling.
However this will eventually come to an end.
I only touch React now, because of SaaS partnerships with Vercel.
Otherwise I pretend it doesn't even exist.