3 ms·
> 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 tin
by 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?
- strogonoff 3y ago> Does preact need a preact-dom library ten times its own size? Does lit? What is it that they do not do? No, but neither does it work outside of DOM. As I wrote in my first comment, you can use React anywhere (native apps, embedded LCDs[0], etc.), as long as you provide a suitable reconciler. It’s a tiny general reactive library that is neither a framework, nor is geared towards DOM/Web in particular. As far as I know, the same cannot be said about Preact. [0] https://github.com/doodlewind/react-ssd1306/blob/master/docs/tutorial.md https://github.com/doodlewind/react-ssd1306/blob/master/docs...
- azangru 3y ago> No, but neither does it work outside of DOM. I know. This thread was specifically about the web though. Web components? If you put React on the web, it is only fair to consider it together with react-dom in all the comparisons. Without a rendering library, React by itself, however small or generic, is not of much use. So what the absolute majority of people mean when they say "react" in the context of building things for the web, is the react/react-dom combination.
- strogonoff 3y ago> I know. This thread was specifically about the web though. Web components? That is exactly the point. This author compares Web Components to React and Astro. Web Components is a spec. React is a general-purpose XML-based reactive GUI rendering library. Astro and Next are frameworks. Next uses React, and Astro can use React. I think you can use React and ReactDOM to render custom elements on the Web already (or will be able to soon), nothing fundamental prevents it. Either the author is not experienced enough to understand what is what, or he tries to gather engagement by inciting a holy war using false dichotomies. > If you put React on the web, it is only fair to consider it together with react-dom in all the comparisons. React-the-library doesn’t cease to exist if you happen to use it with ReactDOM. It also doesn’t automatically become a framework. In addition, the Web exists within the rest of reality. Even if all of the above contenders were also libraries, if one library works independently of particular medium (e.g., can be used in native applications, etc.) then it exists on another level than any Web-centric library.