It’s more of an idea than a library. The idea’s good but the implementation is awkward and incomplete. You’re endlessly writing boilerplate and incorporating libraries for even basic and typical cases that a more thoughtful design would make unnecessary. Even with multiple evolutions the problems are only somewhat resolved. The virtual DOM was a bad idea from day 1 and remains so. React wants components to be the unit of rendering, but an app wants a component to be a unit of app UI. These concerns end of conflicting and competing, which the dev has to do the heavy lifting to resolve, with things like useMemo/Callback. It uses javascript to represent HTML (HTML is already the ideal way to represent HTML declaratively).
> HTML is already the ideal way to represent HTML declaratively
I'm curious what you mean by "declaratively", and I wonder why everyone puts so much value into that particular idea. What is declarative? Is it different/better than using pure functions? Why? If not, why doesn't HTML have (pure) functions?
Declarative just means declaring the result rather than specifying how the result is achieved. (It naturally implies the existence of something else that can realize the declarations. E.g., HTML needs the browser to render it.)
Pure functions are declarative. It's flexible so you can push it to the point where it's essentially a tortured imperative form, but you're probably doing wrong if you get to that point.
The goal of react and other web UI libraries targeting browsers and web views is to render HTML, but dynamically, based on the immediate application state. HTML isn't dynamic and we naturally want to use Javascript for the dynamic part (due to history and Javascript's great flexibility).
You can use HTML for the HTML and Javascript for the dynamic stuff. A lot of things work this way. But react decided to use Javascript for both the HTML and the dynamic stuff. JSX mitigates this to a degree, but it actually represents XML, not HTML. Thus you use className instead of class, close <input> tags, etc.
The reason why I don't think HTML is the ideal way to represent HTML declaratively is because HTML does not have pure functions or any sort of proper first-class values.