Live data from Hacker News

It's time for modern CSS to kill the SPA

jonoalderson.com

511–516 of 516 posts

Re: It's time for modern CSS to kill the SPA

#511

"It’s faster, simpler, and better for everyone." For who? In the modern day and age most devices can handle some JavaScript just fine. The DX provided by front end frameworks/libs is just unrivaled. Vanilla JS/jQuery work fine for small stuff, things quickly get out of hand in complex projects, when you have to bake in things like UX, validations, and have to program around the limitations of HTML. I'm confused as to…

> The DX provided by front end frameworks/libs is just unrivaled How? I spent 6 months exploring React, Vue, Node, Next,... The DX for all of them sucks. The documentation sucks. Everything is wrappers of wrappers of npm scripts of wrappers of bootstrappers of boilerplate builders of... Seriously. The worst.

Sucks compared to what?

Vite (build tool) + React is all you need, and a command line away from setting up React with TypeScript. If you don't like how "heavy" it is, you can use Preact. Similarly, for a Node (express) project, all you gotta do is `npm i express`, with additional setup if you want TS and other dev. niceties. Or just use a batteries included framework like Nest/Adonis and skip all that.

It's not that complicated, the frontend targets the browsers, so you have to transpile if you want to ensure compatibility, prevent theft, reduce the size, or not, and you could just wing it using the plain source code.

Again, it's the best for writing APPS. For an app, with complex navigation, features, UI states, it find it asinine that your biggest complains are about the packages.

Re: It's time for modern CSS to kill the SPA

#512

CSS is a mess for anything besides basic static layout. You can force it to do fancy things, but it's hacky and gives you code that doesn't really say what it does. You can do scss, sass, etc, but still eh.

Yeah, like this https://lyra.horse/fun/tic-tac-nohtml/ tic tac toe without JS and HTML, only a tag.

I mean it's incredible, but you know what will happen to you if you write a production code like this.

Re: It's time for modern CSS to kill the SPA

#513

Earlier quoted context omitted.

But even if you SSR them you still need to send at least 100KB (and probably far more) of JS down to the browser to hydrate state and handle any interactivity.

You need JS to handle interactivity no matter what. And 100KB is nothing, a single image is larger.

Do you? On a blog? 100KB of JS is not the same as an image. Image can be downloaded and decompressed in microseconds even on a slow device. 100KB+ of JS can take a lot longer.

Re: It's time for modern CSS to kill the SPA

#514
post #332

Earlier quoted context omitted.

I 100% would like to see an MPA Google Maps. Being able to come back to a webpage with previous directions? I think it would be glorious.

that has nothing to do with an mpa these days there's a "copy link" button for directions which you can save / share

Which converts your waypoints into addresses and then on load tries to find those addresses. The result is utterly unusable in a remote setting like a forest service or BLM roads.

Re: It's time for modern CSS to kill the SPA

#515
post #398

Earlier quoted context omitted.

> We don't have any hyper-fancy interactive components that would require heavy JS libraries. And yet... we develop in React. Is React really a "heavy" library? https://bundlephobia.com/package/react@19.1.0 > The React view took me 52 minutes, plus I later found out that I'd forgotten a damn type on some interface that's a shallow copy of our model. This sounds like bad architecture, nothing about React would necessi…

Whenever someone presents an anecdote like this, there is always someone who says “but then you are doing react wrong”. Ok, so why is it possible to do it so wrong so often then? That sounds like a downside of the tool. It is a sharp knife. That doesn’t mean there is no place for react, but it also doesn’t mean we have to wipe it under the rug and pretend like it is everybody else’s fault. I never read a story about…

I'm working on a React code base that literally uses over 100 lines of code to navigate to the next page. It also takes about 20 lines of code to have a link. It seems like React devs have never programmed outside of React.

I do like front end libs. I use them sometimes for the right context. But all the business apps I've worked on have never needed a front end lib. With web components even less so than before as the state based interactions that are local to that input element or some other element doesn't need a full blown framework.

My favorite front end lib right now is VanJS. It feels like writing straight vanilla JS without the cruft of writing actual vanilla JS. HTMX is good too, if you are working with back end state but need a little more smooth interaction. Of course, Datastar, html-form, etc all work too.

Re: It's time for modern CSS to kill the SPA

#516
post #489

Earlier quoted context omitted.

Whenever someone presents an anecdote like this, there is always someone who says “but then you are doing react wrong”. Ok, so why is it possible to do it so wrong so often then? That sounds like a downside of the tool. It is a sharp knife. That doesn’t mean there is no place for react, but it also doesn’t mean we have to wipe it under the rug and pretend like it is everybody else’s fault. I never read a story about…

> “but then you are doing react wrong” My objection is not that they are doing React wrong, it’s that their complaint is incoherent because there is literally nothing about React that could make this task take an hour. React isn’t a form library. You write the markup for an html input element, if it’s a controlled input you have a trivial one-line change event handler, and you have a submit event handler. Any additio…

It took me an hour to add a link to the page because I had to learn about how the React Router works and learn how to set it up for the page I was on. With HTML it takes a couple of minutes, no need to set up props, pull in a library. I just create the link and the anchor tag and bam! Just like that I'm done!
Post reply on HN