5 ms·
I often see novice developers making the mistake of comparing React to Web Components, to htmx, to Qwik, etc. React is not an equivalent of Web Components, but
by strogonoff 3y ago
I often see novice developers making the mistake of comparing React to Web Components, to htmx, to Qwik, etc.
React is not an equivalent of Web Components, but neither it is a front-end Web framework: it is neither a framework, nor it is specifically for the Web. What it is is a fairly small and general reactive GUI library[0]. Together with ReactDOM—a separate library—it can be used on the Web, but React itself can be used to render anything anywhere if you provide a suitable reconciler.
As such, React (itself as old as Web Components) may well still be there whether or not the state of the art in front-end Web development moves on to whatever the next stack might be.
[0] The distinction between frameworks and libraries, which tends to be lost on many fresh developers as well, is out of scope here but vital when it comes to software architecture.
- azangru 3y ago> React is not an equivalent of Web Components, but neither it is another web framework. What it is is a tiny and very general reactive GUI library. As for tiny, react-dom currently stands at 42kb minified gzipped. A tiny library would be about 1/10th the size (compare with preact or svelte). Also, react has nasty rerendering habits, which makes if feel not so tiny at times. But more importantly, have you read React docs recently? Have you seen how the official position of the core team is that if you are starting out with react, you should just pick a framework (Next or Remix)? Have you seen the extra complexities that these frameworks start to introduce (client-side state management in the age of server components, anyone)? React is no longer a tiny and very general reactive GUI library. For a tiny and general reactive GUI library, look at Lit. React, meanwhile, is attempting to become a kitchen-sink.
- steve_adams_86 3y agoReact promoting the use of frameworks by default is especially problematic because these frameworks are maintained by people who have profit incentives (either due to investor funding and/or because they sell products based around the framework). They aren’t just open source React frameworks; they’re open source products for companies using them as business engines.
- wg0 3y agoReact is the Spring framework of the frontend world.
- strogonoff 3y agoThis is factually incorrect. React is 6.4kB minified. What you are talking about is a bundle of React and ReactDOM. Remember: these are libraries. They compose. You can use one and not the other, e.g., if you are not rendering to DOM (and in fact even if you are rendering to DOM, but you come up with something smaller and more performant than ReactDOM that suits your requirements). If you are saying “React is bigger than X”, you are comparing apples to oranges unless X can also do what React does. Which, per my previous comment, none of those frameworks can. > more importantly, have you read React docs recently? Have you seen how the official position of the core team is that if you are starting out with react, you should just pick a framework (Next or Remix)? It’s a combination of two factors: 1. Being a library, it’s by definition open to frameworks being built on top of it that facilitate library’s integration in specific solutions in specific ways. Without getting into the nitty-gritty of what it means to be a library or a framework, those frameworks add constraints on how the library is used, but they add value by providing scaffolding and streamlining some use cases. Therefore, it could sort of make sense to tell a novice front-end Web developer to just use a framework to get things done. 2. Unfortunately, React is increasingly being influenced by commercial platforms that use those React-based frameworks (e.g., Vercel). I believe some of the original React developers moved from Facebook to some of those companies. Those companies have vested interest in sending people their way, and I suppose they are or they feel entitled to use React’s reputation for that. I also think they are incentivised to not make React’s documentation particularly easy to use, to keep some features private while using it themselves (cf. RSC) for as long as they can get away with, etc.
- azangru 3y ago> This is factually incorrect. React is 6.4kB minified. What you are talking about is a bundle of React and ReactDOM. If you look at my comment again, you may notice that I wrote "react-dom". I checked before writing. > If you are saying “React is bigger than X”, you are comparing apples to oranges unless X can also do what React does. Which, per my previous comment, none of those frameworks can. Does preact need a preact-dom library ten times its own size? Does lit? What is it that they do not do?
- 3y ago
- troupo 3y ago> I often see novice developers making the mistake of comparing React to Web Components, to htmx, to Qwik, etc. > React is not an equivalent of Web Components The only people who promote these comparisons and draw these equivalencies are the people who promote web components under the weird mantra of "use the platform".