Most active commenters
  • usrbinenv(6)
  • graemep(5)

←back to thread

50 points senfiaj | 15 comments | | HN request time: 0.001s | source | bottom
1. usrbinenv ◴[] No.45809379[source]
If I could make one law related to software, it would be to ban React and React-like frameworks (includes Vue and Svelte I believe): if you have to put more than one line of HTML in your JavaScript, if you have VDOM, if you have a build step - I want this to be illegal. It is entirely possible to write a js-framework that attaches itself to DOM from the top, without any kind of expensive hydration steps or VDOM or templating (I've built one). React is a horrible complex monster that wastes developers time, heats up users' CPUs and generally feels super slow and laggy. 99% percent of websites would work a lot better with SSR and a few lines of JavaScript here and there and there is zero reason to bring anything like React to the table. React is the most tasteless thing ever invented in software.
replies(3): >>45809418 #>>45809650 #>>45809781 #
2. anon-3988 ◴[] No.45809418[source]
Why not ditch HTML itself? People are already downloading binary blobs on a daily basis anyway, just download some binary once, execute them in some isolated environment. So you only have to transmit data.
replies(3): >>45809476 #>>45809497 #>>45809616 #
3. WesolyKubeczek ◴[] No.45809476[source]
Ehrm, have you seen how fancy UI stuff is being implemented in so-called "native apps" these days? Anything more complicated than a button or label or other elements familiar since 1993 gets shoved into a webview and rendered with HTML and CSS.
4. usrbinenv ◴[] No.45809497[source]
I don't see a problem with HTML. It's easy to learn, easy to use and a very nice format for web. CSS is also great. JavaScript is pretty great too. My point is that modern web is horrible because people with no taste and no understanding of the underlying technologies turned it into a horrible shitshow by inventing frameworks that turn the web upside down and making a bloat out of it. I don't hate many things in life, but this one - with passion, because every time I visit a website, I can just feel it's made with React because of how slow and laggy it is.
5. graemep ◴[] No.45809616[source]
Do not know to what extent you are serious, but I think the idea is that content should be HTML and apps should be just JS.

We could go further and have a language written to run in a sandbox VM especially for that with a GUI library designed for the task instead of being derived from a document format.

replies(1): >>45809641 #
6. usrbinenv ◴[] No.45809641{3}[source]
Yeah, I think my point was misunderstood: part of what I'm opposed to was writing HTML (or worse, CSS) inside .js files.
replies(1): >>45813050 #
7. graemep ◴[] No.45809650[source]
> It is entirely possible to write a js-framework that attaches itself to DOM from the top, without any kind of expensive hydration steps or VDOM or templating (I've built one)

Can you elaborate more on how this works? Do you mean JS loading server generated HTML into the DOM?

replies(1): >>45809670 #
8. usrbinenv ◴[] No.45809670[source]
Server renders the page. Suppose you have a element there which reads like <div data-component="HenloComponent">...</div>. Then the .js framework which was loaded on that page queries the DOM in search of any elements with data-component attribute and creates instances of HenloComponent (which is a class written by you, the developer, user of the framework). It's a bit more complicated than that, but that's the essence of it.

Note that with this approach you don't need to "render" anything, browser already done it for you. You merely attaching functionality to DOM elements in the form of Component instances.

replies(1): >>45809735 #
9. graemep ◴[] No.45809735{3}[source]
Yes, that is what I was asking about.

I entirely agree. It is what I do when I have to - although I mostly do simple JS as I am a backend developer really, and if I do any front end its "HTML plus a bit of JS" and I just write JS loading stuff into divs by ID.

When i have worked with front end developers doing stuff in react it has been a horrible experience. In the very worst case they used next.js to write a second backend that sat between my existing Django backend (which had been done earlier) and the front end. Great for latency! It was an extreme example but it really soured my attitude to complex front ends. The project died.

replies(2): >>45809822 #>>45809952 #
10. athanagor2 ◴[] No.45809781[source]
> React and React-like frameworks (includes Vue and Svelte I believe)

Putting React with those two is a wild take.

> 99% percent of websites would work a lot better with SSR and a few lines of JavaScript here and there and there is zero reason to bring anything like React to the table.

Probably but as soon as you have a modicum of logic in your page the primitives of the web are a pain to use.

Also, I must be able to build stuff in the 1% space. I actually did it before: I built an app that's entirely client-side, with Vue, and "serverless" in the sense that it's distributed in the form of one single HTML file. Although we changed that in the last few months to host it on a proper server.

The level of psychological trauma that some back-end devs seem to endure is hilarious though. Like I get it, software sucks and it's sad but no need to be dramatic about it.

And btw, re forbidding stuff: no library, no process, no method can ever substitute to actually knowing what you're doing.

replies(1): >>45809856 #
11. usrbinenv ◴[] No.45809822{4}[source]
Oh no, they do that? I thought Next.js is a fully functional backend itself, like Django. But I'm shocked to learn that it's just a middleman-backend to render templates that are already served from another backend.
replies(1): >>45812927 #
12. usrbinenv ◴[] No.45809856[source]
You can do very complex stuff without any need for React like approach. I literally said I've written a very sophisticated framework that was exceptionally snappy - that's what should be used for that 1% (not my framework, but the approach). Even better, I could introduce it very gradually and strategically on different SSR pages and then (if I wanted to) I could turn the whole app into an SPA - all without needing to "render" anything with JavaScript, VDOM or other such nonsense.
13. athanagor2 ◴[] No.45809952{4}[source]
> In the very worst case they used next.js to write a second backend that sat between my existing Django backend (which had been done earlier) and the front end.

That's hilarious.

Casey Muratori truly is right when he says to "non-pessimize" software (= make it do what it should do and not more), before optimizing it.

14. graemep ◴[] No.45812927{5}[source]
Next.js is a a fully functional backend. Its not Next's fault - I dislike it for other reasons, but this was not a Next problem.

The problem was that the front end developers involved decided to use Next.js to replace the front end of a mostly complete Django site. I think it was very much a case of someone just wanting to use what they knew regardless of whether it was a good fit - the "when all you have is a hammer, everything looks like a nail" effect.

15. graemep ◴[] No.45813050{4}[source]
Yes, I think you were misunderstood.

I think HTML inside JS is a code smell. I cannot even imagine why you would need CSS inside JS.