Why I Like React (even in 2024)
ejosh.co
ejosh.co
> <Tag a="b" x={y+z}>{valid JS expression}</Tag> > is > React.createElement(Tag, { a: "b", x: y + z }, [<valid JS expression>])
If you take the main reasons React is criticized and claim it is a feature, surely you have refute the criticism more thoroughly than "This seems so simple, yet do not underestimate it." or "That is powerful. Do not underestimate this."
Modern frameworks (Svelte / Vue / Astro) are about using the platform. They are performant, efficient, easier to read, easier to write, and easier to understand.
I don't see any reason I would pick React for a greenfield project anymore.
I get that if YOU don't want to use a modern framework and want to stick with what you know, sure, by all means, pick React. But writing even a semi complex application in both React and Svelte should make it immediately obvious that React is antiquated, if you give both frameworks a fair shake.
Proof? Source?
>I don't see any reason I would pick React for a greenfield project anymore.
I don't see why you wouldn't. It's stable, performs well, works in every browser, easy to find answers for problems you run into, and almost every knows it (or should, it's 2024, you don't have an excuse anymore).
>I get that if YOU don't want to use a modern framework
React is the modern framework. It's nimble, concise. The other frameworks are regressive -- they make mistakes that older frameworks already highlighted as being problematic over time.
https://joshcollinsworth.com/blog/self-fulfilling-prophecy-o...
It's been a few months since I read it, but I recall the main thing I took away from this was: React isn't necessarily the best choice, other frameworks provide better performance, development experience and tooling that should also be considered
Of course these are just opinions. Everyone should consider all the facts and come to their own conclusions about what they use and don't use.
Companies will continue to use React of course. But I'm not sure if I would use vanilla React for anything I have complete control of.
I understand them quite well. I would say I probably understand them better than OP.
But this is so table stakes nowadays it's like saying your restaurant has a bathroom.
Each person that I’ve come across who likes react is super smart and I can’t follow what they are trying to say is so great. So maybe don’t listen to me anyway.
It made front end approachable and for that I’m grateful.
if you just like templating in JavaScript do so, that doesn't mean you want react
The author even mentions Solid, so presumably he's aware that there are other frameworks utilizing JSX.
My JSX-based but not React framework has one large direct dependency (RxJS), but still comes in less than react-dom and comparable to preact:
https://bundlephobia.com/package/butterfloat@1.4.0
Similarly, I have to keep remembering that when trying to argue for web component embedding that it isn't competing with just lit, but generally lit and lit-html together:
https://bundlephobia.com/package/lit@3.1.2 https://bundlephobia.com/package/lit-html@3.1.2
I wonder if bundlephobia needs more of "peer dependency" mode.
In the case of lit, I think lit-html actually is a direct dependency of lit (unless I'm reading it wrong)? In the composition section at the bottom of lit's Bundlephobia page it says lit-hmtl makes up 46.1% of lit's bundle size.
The one thing you do have to remember about lit though is that if you're server side rendering you'll also need the @webcomponents/template-shadowroot polyfill, and @lit-labs/ssr-client/lit-element-hydrate-support.js [2].
I agree that Bundlephobia needs a peer dependencies mode. It still might be tough to be exhaustive about these things because react-dom depends on react as a peer, but confusingly the reverse is not true, because even though almost everyone is using react with react-dom, you could technically render to a different target (e.g. Ink uses react to render terminal UIs). Bundlephobia would need to be aware of packages that are so commonly used together that they're de facto peer dependencies, even if they're not de jure peer dependencies.
I tried out Deno+Fresh and Astro. Both are JSX based, but they're not React. And JSX-based things are now starting to offer really compelling features you'd have to glue together yourself or can't do in React directly. The single biggest thing I've really liked about Fresh and Astro is the both allow you to ship vanilla HTML with 0 JS without any effort, as well as easily enabling dynamic island functionality for areas where you do want it without going full blown SPA.