Live data from Hacker News

Ask HN: How does one build large front end apps without a framework like React?

news.ycombinator.com

61–70 of 197 posts

Re: Ask HN: How does one build large front end apps without a framework like React?

#61

It’s always mildly amusing how many engineers believe that React is a framework. I personally attribute it to lack of experience—once you’ve used enough proper frameworks, you’d laugh at that comparison. The fact that React is and always has been literally defined as a library right on its website doesn’t seem to stop them. Incidentally, many of the issues people have with React are attributable to this mistake: know…

If you go to the React website you need to click "Learn React". A library often does not make you learn new concepts. It is just functions with input and output.

On the first page "Quickstart" all code blocks contain code that contain JSX and call you. They do not even show the part where you need to call render. Copying this code into your codebase will not do anything.

On that same page they also introduce state management with hooks.

On the installation page npm installing react is not mentioned. They suggest using create react app.

Sure you can theoratically use react as a library but I've never seen it and from the website it seems like usage as a library is not the inteded way to use react.

The first sentence "The library for web and native user interfaces" is the only thing pointing to react being able to be used as a library. The rest of it looks like a framework to me.

Re: Ask HN: How does one build large front end apps without a framework like React?

#62
post #52

The reasons I avoid large frameworks like React, Angular, Vue, and even jQuery is that they are aren't necessary. They are code decoration that slows things down. Here is what you can expect without these: * greater flexibility * faster execution, My current application produces a large single page application that fully renders visually and executes state restoration in about 105ms localhost or under 200ms across a…

Not sure how you avoid reinventing any of the component frameworks. Writing custom JS component backbone style seems tedious and error prone. Manually modifying the DOM on changes means writing the same logic several times, once for the initial render and then repeated in every event handler that has change the state of the UI. Alternatively, you might just be nuking your DOM with inner html and then running everythi…

If you are writing the same DOM update code in each event handler you can abstract it into a function.

Re: Ask HN: How does one build large front end apps without a framework like React?

#63
Addressing the very first sentence in this post:

> I had a mind-blown-moment when I learnt that Obsidian was built without any frontend JS framework.

The comment you’ve linked to is wrong. Obsidian uses the Electron framework for its “front-end” framework.

In fact, it was even affected by the recent “Tahoe” Electron bug.

https://en.wikipedia.org/wiki/Obsidian_(software)#Availabili...

Re: Ask HN: How does one build large front end apps without a framework like React?

#64
post #52

The reasons I avoid large frameworks like React, Angular, Vue, and even jQuery is that they are aren't necessary. They are code decoration that slows things down. Here is what you can expect without these: * greater flexibility * faster execution, My current application produces a large single page application that fully renders visually and executes state restoration in about 105ms localhost or under 200ms across a…

Not sure how you avoid reinventing any of the component frameworks. Writing custom JS component backbone style seems tedious and error prone. Manually modifying the DOM on changes means writing the same logic several times, once for the initial render and then repeated in every event handler that has change the state of the UI. Alternatively, you might just be nuking your DOM with inner html and then running everythi…

> Not sure how you avoid reinventing any of the component frameworks.

You don't do framework nonsense. That is all there is to it.

For most people writing JavaScript for employment it is absolutely impossible to imagine any universe where a couple of lines of code could be written without something that looks like a framework. That is not a limitation of the language, but rather a limitation of the given developer's imagination. The problem is thus a person problem and not a technology problem.

I do not use innerHTML because that is string parsing, and one of my critical performance steps is to avoid parsing from strings, except JSON.parse when needed.

Re: Ask HN: How does one build large front end apps without a framework like React?

#65

The reasons I avoid large frameworks like React, Angular, Vue, and even jQuery is that they are aren't necessary. They are code decoration that slows things down. Here is what you can expect without these: * greater flexibility * faster execution, My current application produces a large single page application that fully renders visually and executes state restoration in about 105ms localhost or under 200ms across a…

> and even jQuery is that they are aren't necessary. JQuery was never considered "necessary". It's just a much prettier wrapper around the native dom apis. Arguing against adopting a more readable api (and codebase), is gonna be a tough sell.

Nobody worries about fashion when buying a shovel. Your users don't care about your code fashion. These things are clear when an outside party can observe your developer habits and inform you where your priorities are as opposed to what you state they are.

Re: Ask HN: How does one build large front end apps without a framework like React?

#66

Earlier quoted context omitted.

> and even jQuery is that they are aren't necessary. JQuery was never considered "necessary". It's just a much prettier wrapper around the native dom apis. Arguing against adopting a more readable api (and codebase), is gonna be a tough sell.

Nobody worries about fashion when buying a shovel. Your users don't care about your code fashion. These things are clear when an outside party can observe your developer habits and inform you where your priorities are as opposed to what you state they are.

> Nobody worries about fashion when buying a shovel.

Huh? Are you implying the code will never get read by another developer or possibly modified? Are you arguing there is no reason to make your code more readable?

> These things are clear when an outside party can observe your developer habits and inform you where your priorities are as opposed to what you state they are.

What?

Re: Ask HN: How does one build large front end apps without a framework like React?

#67

The frontend of my main OSS work was made is plain es6: https://github.com/mickael-kerjean/filestash The frameworky code is under 100 lines of code, heavily inspired by what I think is a good idea from React: "components are pure function", the simplest example of the about page beeing visible here: https://github.com/mickael-kerjean/filestash/blob/master/pub... Since the whole project was migrated over from React, I…

Exactly what I was looking for! Thank you! :)

Re: Ask HN: How does one build large front end apps without a framework like React?

#68
A LOT of websites don't need a "front end" framework (apart of the one that is already there: html, css).

Could need some js library and that is a maybe.

In general:

If is like a eCommerce site, blog, wikipedia, forum? Not need

If is like a Game, Paint app, form builder? Need.

And how you learn it? Not use a framework, and try to stay with things more minimal, like tailwindcss.

Re: Ask HN: How does one build large front end apps without a framework like React?

#69
post #50

Spritemate is built with TypeScript + Vite + JQuery, and has a pretty organized structure: https://github.com/Esshahn/spritemate (I do not condone its use of the 'any' type everywhere tho) I wouldn't use JQuery for a new project, as you can do almost everything it does with straight DOM manipulation. But there are still some strategic vanilla JS/TS packages that come in handy, e.g. clipboard, mousetrap, file-saver, s…

Thanks for the reference! Yep, part of why I made this post is to see how I can avoid the innerHTML attribute. Do you think Obsidian's use of dompurify is closely related to their choice of going vanilla?

Re: Ask HN: How does one build large front end apps without a framework like React?

#70
post #52

Earlier quoted context omitted.

Not sure how you avoid reinventing any of the component frameworks. Writing custom JS component backbone style seems tedious and error prone. Manually modifying the DOM on changes means writing the same logic several times, once for the initial render and then repeated in every event handler that has change the state of the UI. Alternatively, you might just be nuking your DOM with inner html and then running everythi…

If you are writing the same DOM update code in each event handler you can abstract it into a function.

What I'm saying, say you have 3 dependent dropdown pickers, selecting an item in the first one determine which of the other 2 are shown. When you have reactive interfaces like that, it's hard to extract the common "business" logic. Either you redraw everything from scratch or you do a sort of show/hide on DOM elements as in jQuery days. Not sure how you can abstract that. If you do abstract it, you end up with backbone, vue, react, or other in any case.
Post reply on HN