Live data from Hacker News

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

pedroth.github.io

101–110 of 117 posts

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

#101
post #41

Earlier quoted context omitted.

I kind of agree but also > what about X feature To which I argue unequivocally YAGNI 95% of apps people actually develop are really just CRUD and could easily get by without JavaScript on the front end at all. They certainly don't justify the layers of complicated state maintenance React and similar systems entail.

> 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.

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

#102
post #92

Earlier quoted context omitted.

Data is cheap and fast, CPU time still isn't. I've profiled numerous web sites on slow Android devices and they absolutely crawl when parsing JS and giant JSON blobs required to hydrate a page that's one big React app for no real reason. > It's not hard anymore to get over the React learning curve. > The idea that React is the enemy of users sounds like a skill issue on your part. You're contradicting yourself here.…

> You're contradicting yourself here. >> Good thing LLMs exist now It's not a contradiction. You were/are unskilled. But it doesn't matter anymore. Just wanted to help you understand this is not a contradiction. You sound like someone who made your mind up about "the state of the industry" a long time ago. While this replay of debates settled a decade ago has been a nice, I must wish you a good day now. I don't mean…

> You sound like someone who made your mind up about "the state of the industry" a long time ago.

pfft: you wrote “React won” above.

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

#103
If your job is to write UI frameworks, by all means do that

Otherwise, yes, you do need React (or something like it). Don't waste time re-solving the problems these frameworks were created to address. Spend your time creating value for your users. Building bespoke state management systems is not needed.

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

#104

Actually browsers already come with a minimal UI library. It's called HTML + CSS + JS. There's actually no need to make any wrappers - you describe what you want in HTML and make it look good with CSS. You only need to make UI using JS only for complex components. Case study: I tried porting an old strategy game from pygame to web using codex. Codex decided that it doesn't need any library and raw-dogged HTML. It was…

The problem is really folks trying to one-size-fits-all web projects. React basically exists to give a “good enough” GUI toolkit functionality in the browser. On the other hand, the web was built to publish content as in articles and information. Everything kind of sits somewhere on the continuum between static content and the interactive app experience. At the extreme it can be interactive “art” piece. It is importa…

> React basically exists to give a “good enough” GUI toolkit functionality in the browser.

and it’s sole usage for so many apps is one of the top-five reasons, following 2010s SPA frameworks, that people believe web apps inherently suck.

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

#105
post #75
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…

Why should a contact form mean complex functionality? You can do it in plain HTML, even - is that complex already? Because validation? Like that (Google, it's you) address checking unable to place my house in the right village? Like phone number validation forcing you to add a 0 where no 0 is required to call me? And don't start me on streets and all that, or middle names, or dates or or or. Validations of form input…

I triggered me as well. I keep seeing that for the front-end frameworks the native HTML regular stuff is usually like something out of this world.

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

#106
I feel the killer feature of doing everything in JS is components. I just want to import something from a library and use it.

Web pages have their code split between HTML, CSS and JS. There is no common story that works for all three except for using JS.

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

#107
post #41

Earlier quoted context omitted.

I kind of agree but also > what about X feature To which I argue unequivocally YAGNI 95% of apps people actually develop are really just CRUD and could easily get by without JavaScript on the front end at all. They certainly don't justify the layers of complicated state maintenance React and similar systems entail.

> 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…

    I'm building an EMR and there is a large portion that is CRUD, but that doesn't mean I don't rely on enormous forms or don't need client-side validation.
Another way to interpret the parent is that the site should degrade gracefully in the absence of client side scripting. Client-side input validation is valuable for an EMR, but best practice when I was involved in that field a decade ago was to avoid free form input entirely to minimize input errors.

My personal suspicion is that most providers would ultimately prefer a well-designed TUI from 1995 to a fancy SPA that stops working whenever the Wi-Fi is slow (i.e. most days).

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

#108

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.

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

#109

Posts like this remind me how much JavaScript could benefit from something like Lisp's quasiquote. JSX is a terrible creation but templating in JS is pretty unpleasant without quotation operators. That said, I think Mithril's 'm' function did it the best of all libraries I have seen.

Yup. The Correct Answer™ was and remains Scheme. Acknowledged by all parties involved (and us baffled bystanders).

The negative consequences of JavaScript rival both \0x00 terminated strings and NULL.

I've never forgiven Brendan Eich or Marc Andreessen.

More positively, Marc did name the HTML's image tag IMG. Maybe by some cosmic measure, his contributions balance out.

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

#110

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…

I'm building an EMR and there is a large portion that is CRUD, but that doesn't mean I don't rely on enormous forms or don't need client-side validation. Another way to interpret the parent is that the site should degrade gracefully in the absence of client side scripting. Client-side input validation is valuable for an EMR, but best practice when I was involved in that field a decade ago was to avoid free form input…

Offline mode exists for SPAs. And TUIs aren't realistic because the nurses use Ipads.
Post reply on HN