My work seems to have made you angry which makes me sad.
You’ll at least be happy to learn that useEffect will be sync if the render itself was sync in React 18. Ofc if you do an async render those effects won’t work anyway and you need to do it in the event handler itself.
I doubt it’s much of a conciliation though. I agree the programming model is weird. It’s the best idea we had for what we were trying to achieve. Sorry for the trouble it has caused you.
My primary issue is that you guys did have other options. You did. I saw the RFC thread. About 2/3s were useless "oh no" or "oh yes" comments, but about a third had suggestions and feedback, some good feedback, on how to make the stateful function API not as jarring and not as weird. You simply ignored it all, since you already had an API in mind (and perhaps already did most of the work, I don't know)
That you thought (correctly) that an eslint package of rules was necessary to prevent people from shooting themselves in the foot with the gun you have provided should have been a hint that it's not good API.
I think this misses the point of what a senior developer is.
Nobody builds a huge thing by themselves better than multiple people can. Being a senior developer is enabling a few other people to do their best work.
(I'm "Sebastian".) It meant to read C. It definitely wasn't C++. However, now I'm curious if I'm confusing it with the later Amiga games. I'll need to look into this. I was 8 years old at the time. :) Note that this was for hobby projects many years after the original launch of those products - not mainstream dev.
If it spread to a become a defacto standard format, wouldn't that be a good thing? That way you only have to deal with this once and it will work everywhere.
At that time, the size/parse time will have much greater impact because the total size of libraries will be smaller or unaffected.
At the same time it encourages libraries to put significant error messages in their code without fear of bloat which helps your customers in the end.
Since the URL to the raw mapping is not in the error and requires external knowledge and the parameters are in free form in the error message I doubt this can become a standard of any sorts. The correct place for this would have been something like sourcemaps.
Parse time is the new bottleneck of modern client-side web apps. Of course React on its own isn't going to move the needle but if other libraries follow along it just might. With better, more expressive error messages without paying the cost at scale.
If you can show me even a contrived example of a React app where the presence or absence of three kilobytes of debug messages makes a measurable difference to performance, I will be very impressed (and humbled).
I'm not so sure I agree there. Not that React isn't fantastic, but I remember a recent release adding support for SVG elements. If I don't use any, it would be great to strip out that functionality - React is not a small library. Alternatives like Preact show that you can have a core set of functionality at a much smaller size.
With the prevalence of npm and mini-libraries I'd be interested to see if the size of React could be cut down and put into optional components.
I don't think tree shaking would help much. Speaking as an author of one of those mini-virtual-dom libraries, from my experience/research, the choices of features to support are usually tightly integrated for performance reasons.
For tree shaking to work, it must be possible to statically infer that some code is not part of the dependency graph of your application. Something like SVG support requires extensions to the virtual dom node structure that the renderer's visitor looks at, so it's quite difficult to make it into a hook and not lose performance to various overheads. It's also worth mentioning that over-modularizing can get boilerplatey (e.g. https://github.com/paldepind/snabbdom#inline-example)
Saving a handful of kb on a JS library quickly gets shot to hell when you have to load up sixteen analytics trackers, an auto-playing video, and a bevy of unoptimized ad images.
There is lower-hanging, bigger-buck-for-your-bang, fruit if you're trying to fight page bloat.
And React can't prevent any of those. React can only change React code, so they optimize it as best as they can, and leave the "user" of React to optimize everything else in their own app.
The point of this is exactly to reduce the library size AND getting to a stable 1.0 release. By making the class system optional, it becomes an optional dependency which reduces the library size. Supporting only createClass in a stable 1.0 release would mean that we're stuck with that dependency.
The way we see it, ES6 and 7 are around the corner and then the createClass dependency becomes optional.
You’ll at least be happy to learn that useEffect will be sync if the render itself was sync in React 18. Ofc if you do an async render those effects won’t work anyway and you need to do it in the event handler itself.
I doubt it’s much of a conciliation though. I agree the programming model is weird. It’s the best idea we had for what we were trying to achieve. Sorry for the trouble it has caused you.