Live data from Hacker News

You don't need React: creating a minimal UI library in Vanilla JavaScript

pedroth.github.io

111–120 of 121 posts

Re: You don't need React: creating a minimal UI library in Vanilla JavaScript

#111

Earlier quoted context omitted.

> 95% of apps people actually develop are really just CRUD and could easily get by without JavaScript on the front end at all. Nearly every app has some version of CRUD, but you're conflating the persistence model with the interaction layer. Just because an app is CRUD doesn't mean it doesn't require complex, client-side interactions. I'm building an EMR and there is a large portion that is CRUD, but that doesn't mea…

Maybe share a better example of a feature needing React than long, input-validated forms. That’s not selling it. Just feels like what you’re used to doing.

I mean, when the bulk of your app is forms it pretty much justifies itself.

OP said:

> JavaScript on the front end at all

Nurses in my app have to complete 200+ question forms, on a tablet, in someone's home. The level of network chatter I'd need to have to pull this off would be too much. And I get a realistic offline mode.

And because I need accessible controls, something like React Aria becomes invaluable.

Re: You don't need React: creating a minimal UI library in Vanilla JavaScript

#112

The whole idea of SPAs is just unfortunate most of the time. If you look at the list of the most popular websites: https://en.wikipedia.org/wiki/List_of_most-visited_websites Basically all of them can be decomposed to: - List of comments/recommendations/pictures (sometimes in a tree), virtualized and lazy loaded - A video - A comment box The irony is that this is super easy to represent in HTML semantically (HTML was…

As usual this discussion is people talking past each other because some people work on web sites and others on web applications. React is great for applications, perhaps not as much for sites. I wouldn't know though.

I have no idea where this meme comes from. They're all just websites! Plenty of "web applications" make more sense as server-rendered Django or Phoenix apps than they do client-rendered React apps.

Re: You don't need React: creating a minimal UI library in Vanilla JavaScript

#113

You don’t need React until you do. And that’s fine. It’s easy to replatform later with LLMs. With vanilla you typically do class based components for organization (which can be quite clean in type=“module” with import/export) and you end up writing a complex View type class that does all the DOM manipulation. You gotta hide the framework somewhere or you’ll repeat yourself a lot Bonus points at scale you invent a tem…

> Bonus points at scale you invent a templating solution. Maybe you use JSX

I think this is an underrated perspective in these discussions.

Re: You don't need React: creating a minimal UI library in Vanilla JavaScript

#114
post #20

I think React is way overused but every time you see a blog post with "replace it with this pet mini project instead" I groan because you know the reaction is going to be "what about X feature", and of course the mini framework doesn't do it. I've found the perfect balance to be Astro with Preact. You will inevitably have some piece of functionality that's complex (say, a contact form) and you can lean into Preact fo…

It’s always such basic reactivity that their little script provides… completely misses the point of react, and honestly applies to almost no projects.

Re: You don't need React: creating a minimal UI library in Vanilla JavaScript

#115
post #89

Earlier quoted context omitted.

Have you tired using several billion Fable tokens in production? It will do whatever you want. So you can still have your opinions on what works best. But it doesn't matter much, it's not 2025 anymore. E.g. always use Rust instead of Python

Ah. I see. A troll account. That explains the 7.5 year account age and only 2 karma.

Oh you forgot a counter argument. Are you upset that you don't have valuable skills anymore?

Some people just disagree but have no logical reason why and then just change the subject, like you demonstrated.

I can tell you have strong emotions about it, and you wish you had something logical to say. Hope you can think of something other than insults.

I assume you use your HN account in an anonymous way and you don't mind appearing so dysregulated to the world?

Lol

Re: You don't need React: creating a minimal UI library in Vanilla JavaScript

#116
post #67

Earlier quoted context omitted.

The blog post page, which appears to use the author's library only loaded 58.6 kB of JavaScript, which is quite low.

Preact is 3kb. The size argument doesn’t hold weight.

The author's library is only 2.47kB.

Re: You don't need React: creating a minimal UI library in Vanilla JavaScript

#117

You don’t need React until you do. And that’s fine. It’s easy to replatform later with LLMs. With vanilla you typically do class based components for organization (which can be quite clean in type=“module” with import/export) and you end up writing a complex View type class that does all the DOM manipulation. You gotta hide the framework somewhere or you’ll repeat yourself a lot Bonus points at scale you invent a tem…

> Bonus points at scale you invent a templating solution. Maybe you use JSX

FYI this exists https://github.com/developit/htm which couples well with preact browser only (no npm/node compilation)

Re: You don't need React: creating a minimal UI library in Vanilla JavaScript

#118

I ran a web dev company for decades. There are two web sites we created I would bet money you have visited so we weren't a small, one-off shop. We had never seen the need or desire to use React. We couldn't understand why anyone else would use it either. It was too big and too complicated versus just using the fundamental elements of programming for the web. So there.

Counterpoint: I'm currently employed building many apps for an enterprise you'll never visit. React+Typescript rewrite of our legacy "lean" Javascript has measurably improved the productivity of the team and the maintainability of code. I can't imagine going back to learning bespoke libraries written by (especially!) hotshot cowboy coders. React makes everybody on the team better, and literally no customer has ever c…

> I can't imagine going back to learning bespoke libraries written by (especially!) hotshot cowboy coders

you are giving too much credit to the React and NextJS maintainers. They are also "hotshot cowboy coders" whatever that means.

Re: You don't need React: creating a minimal UI library in Vanilla JavaScript

#119
post #12

unlike many of the commenters, I found this pretty nice and educational, there are full stack developers who cannot write anything outside React and do not even understand why React was created in the first place

Nice! positive comment

don't let the negative comments affect your mood, lots of people here are too invested.

It is difficult to get a man to understand something, when his salary depends on his not understanding it.

Re: You don't need React: creating a minimal UI library in Vanilla JavaScript

#120
post #5

Minimal UI library results in maximal App code, which makes it a good usecase for why you're better of with React/Vue

I looked at the author's website, and a typical page downloaded around 60kb or less of JavaScript.

that's less than just React
Post reply on HN