News for hackers. Stuff that matters.
Re:Breaking up with JavaScript front ends by arcturus17 on Saturday December 10, 2022 @05:25PM (#33937580)
I agree with everything you say, but I'm in the camp that thinks that front-end is stabilizing.

I feel many web projects can go a long way with something like NextJS, a few classic libs (eg, lodash/underscore/ramda), maybe a few libraries for handling data if you really need them. The design frameworks (MaterialUI, Tailwind, etc.) are also fairly stable.

Perhaps that's one dependency too many for some?

Re:Breaking up with JavaScript front ends by CharlieDigital on Saturday December 10, 2022 @06:48PM (#33938320)
Next.js is really bad, IMO and perpetuates more bad practices.

Both Target.com and Walmart.com are Next.js apps.

Both utilize SSR to render the pages (view the markup in the network tab).

Both then STILL send the full data model to the UI (check the `__NEXT_DATA__` on Walmart.com and `__TGT_DATA__` on Target.com) because Next.js doesn't quite offer the right amount of control over what to send back (compare this to Astro.js, which does offer control over which data is needed for the client-side binding).

Next.js handling of images is ugly. It creates tag soup for responsive images instead of using native HTML and CSS capabilities (again, compare it to Astro.js and it's night and day).

Their stunt and exaggerated numbers with Turbopack further contributes to fracturing the front-end community and introduces Yet Another Tool instead of plugging into Vite.

Re:Breaking up with JavaScript front ends by Rauchg on Saturday December 10, 2022 @07:00PM (#33938400)
> Both then STILL send the full data model to the UI (check the __NEXT_DATA__ on Walmart.com and __TGT_DATA__ on Target.com) because Next.js doesn't quite offer the right amount of control over what to send back (compare this to Astro.js, which does offer control over which data is needed for the client-side binding).

Those two particular customers use `getInitialProps` which allows them to respond which exactly the data they need to render those pages. Can you tell me more about what other capabilities you'd like to see there?

You'll also want to check out our work into React Server Components (https://nextjs.org/blog/next-13#server-components) which addresses both data payload size and bundle size.

> Next.js handling of images is ugly. It creates tag soup for responsive images instead of using native HTML and CSS capabilities (again, compare it to Astro.js and it's night and day).

Have you seen our updated image component? It's just an `<img>` tag, it uses all the native browser capabilities, and doesn't depend on React hydration (it even works with JS off!). Here's a demo[1] and here are the details[2].

> Their stunt and exaggerated numbers with Turbopack further contributes to fracturing the front-end community and introduces Yet Another Tool instead of plugging into Vite.

We've been working really closely with Evan You from Vite to present the data in the most clear way possible. Next time we'll make sure that any project we reference has a chance to submit feedback before we publish. We also contribute to SWC which Vite 4 has shipped plugins for[3]. We're quite confident Turbopack will continue to have a positive impact in the ecosystem.

[1] https://image-component.nextjs.gallery/placeholder

[2] https://nextjs.org/blog/next-13#nextimage

[3] https://vitejs.dev/blog/announcing-vite4.html#new-react-plug...

Re:Breaking up with JavaScript front ends by sph on Sunday December 11, 2022 @02:43AM (#33941104)
Is getInitialProps still incompatible with hooks? Does Next.js have a functional way of doing that now?
Re:Breaking up with JavaScript front ends by arcturus17 on Saturday December 10, 2022 @07:12PM (#33938490)
I don't understand the "right amount of control" bit, there are plenty of options to control what data moves to and fro in NextJS, but the CEO of Vercel has replied to you in a sibling comment; he's going to be able to address your technical concerns better than me.

I'll just add that I'm not familiar with either of those sites, because I'm sitting in Spain and neither operate here, but on first inspection the UX has felt brilliant to me - particularly Walmart's. Everything loads very fast, the search is great, etc. I cannot say if their code or eng practices are a tire fire but the product looks good to me.

Re:Breaking up with JavaScript front ends by CharlieDigital on Sunday December 11, 2022 @11:45AM (#33944749)
> I don't understand the "right amount of control" bit

Try Astro.js and you'll understand. If the data has been used to SSR and has no function on the client side, don't send it to the client.

If two multi-billion dollar, multi-national corporations with multi-million dollar project teams can't get it right in a space where every ms counts, then the average team has no hope.

Re:Breaking up with JavaScript front ends by medbrane on Sunday December 11, 2022 @03:02PM (#33946891)
What you ask for is now possible using Next.js and the new React Server Side components. Check the link in the sibling comment tree.
Re:Breaking up with JavaScript front ends by Rauchg on Sunday December 11, 2022 @03:48PM (#33947329)
That's definitely what RSC accomplishes, which I mentioned in my comment.
Re:Breaking up with JavaScript front ends by epolanski on Saturday December 10, 2022 @08:57PM (#33939224)
Also, its implementation details include monsters like monkey patching native fetch which lost me insane amounts of money and time to be found (file uploads with more than 15 kb of data broke everything).

next is nothing more than yet another bloated collage of poor ideas with poor execution, but they have marketing going for them.

Re:Breaking up with JavaScript front ends by Existenceblinks on Sunday December 11, 2022 @12:55AM (#33940493)
Next.js also get into many of my govt's websites. It's the worst in any direction. I can explain why with bullets but so tired of these repetitive well-known reasons already.
Re:Breaking up with JavaScript front ends by Aeolun on Sunday December 11, 2022 @01:39AM (#33940720)
Next.js is really easy for developers of all levels to work with though. It’s main benefit is the ease of use, not the optimized client side data transfer.

What I see from Astro.js is a lot of magic. This is great if it works, but chances are it won’t for a lot of people.

Re:Breaking up with JavaScript front ends by cies on Sunday December 11, 2022 @08:13AM (#33942861)
Did you try Qt and QML for creating a GUI? It's soo much easier on the brain its not even funny.
Re:Breaking up with JavaScript front ends by Aeolun on Sunday December 11, 2022 @10:10AM (#33943809)
A long time ago. It was so painful I resolved to never do the same thing again.

Presumably things have changed in the meantime, but I just don’t see the point any more. Web has won and my experience is there already anyway.

Re:Breaking up with JavaScript front ends by siquick on Saturday December 10, 2022 @10:59PM (#33939928)
If those are the only complaints you have about Next then they’re doing great.
Re:Breaking up with JavaScript front ends by CharlieDigital on Sunday December 11, 2022 @11:42AM (#33944722)
Those are on top of why React is not the way.
Re:Breaking up with JavaScript front ends by esskay on Saturday December 10, 2022 @07:32PM (#33938630)
it'll be stable when the JS community stops reinventing the wheel several times a year. Every year we have the 'next big thing' and a whole new JS framework and ecosystem thats set to be the one to beat them all.

Fast forward 2 years, its mostly abandoned and upgrading a 12 month old project is a nightmare. That is not stable.

I can pick up a PHP, Python, <insert other language here> script written 2-3 years ago and know it'll work if I try to do something with it. With JS you can guarantee that one of the bajilion dependancies has had a backward breaking change or vanished off the face of the earth and the whole thing falls apart.

JS tooling, and always has been a total disaster, and NextJS hasn't fixed that.

Re:Breaking up with JavaScript front ends by arcturus17 on Saturday December 10, 2022 @07:54PM (#33938781)
I've been coding my front-ends in React for 5 or 6 years. I don't have any of the problems you describe, I can also pick up old projects and run them without much problem. There was the change from classes to hooks but I still remember classes fairly well. Then there's been NextJS which I've picked up in like a weekend. That's it.

There are new frameworks popping up all the time. Some look very interesting. But React has been around since 2013 and it's a world standard.

I agree that JS/TS tooling is largely a mess, it's why I don't like JS/TS back-ends other than maybe some simple NextJS API routes, or an Express server with something like three files. But on the front-end, React CRA and NextJS (with TypeScript) both have served most of my needs with just a few CLI commands and minimal config. I rarely have the need to meddle with the tooling and I can get up and running in seconds.

Re:Breaking up with JavaScript front ends by miyuru on Sunday December 11, 2022 @03:03AM (#33941199)
I was given a old unmaintained react project to build a pipeline and the only way to run it was on node 12. It would not even build on latest node versions.
Re:Breaking up with JavaScript front ends by SwiftyBug on Sunday December 11, 2022 @04:18AM (#33941588)
That's absolutely expected. Good news is that it's trivial to install whichever Node version you like.
Re:Breaking up with JavaScript front ends by arcturus17 on Sunday December 11, 2022 @03:32AM (#33941364)
Would this be out of the realm of possibility if you inherited, say, an old Django or .Net project?
Re:Breaking up with JavaScript front ends by jiggawatts on Sunday December 11, 2022 @01:06AM (#33940565)
"I haven't died playing russian roulette, you should try it too."

The general experience across the industry in a statistical sense is that JavaScript frameworks are a tyre fire best avoided.

I'm yet to see a JS app that doesn't need constant maintenance to remain compilable.

Meanwhile, the ASP.NET ecosystem had like one significant breaking change since like... 2002.

Re:Breaking up with JavaScript front ends by JackMorgan on Sunday December 11, 2022 @06:18AM (#33942243)
JavaScript itself is entirely backwards compatible back to 2002. If anything, I'd argue raw .NET is far worse than raw JS for backwards compatibility, because .NET has depreciated entire languages like VB6.

To compare something like React to .NET, let's look at .NET libraries and frameworks. For example: Sliverlight, WebForms, WPF, WCF SOAP, old versions of EF, or old versions of MVC. It's not been pretty for .NET, and you're in a bad place if you still have a Sliverlight app in 2022 because it only runs on IE11.

Every language and library suffers/benefits from the onward march of progress. It's disingenuous to claim JS is the only ecosystem that has significant churn.

Re:Breaking up with JavaScript front ends by pjmlp on Sunday December 11, 2022 @10:02AM (#33943754)
WebForms, WPF and EF 6 have been ported to .NET Core.

WCF althought not initially supported, the industry has made enough pressure, that most of it is now available on WCF Core.

SOAP libraries still exist.

Thanks to the magic of WebAssembly, you can port that 2002 Silverlight application to OpenSilver, and use it on any modern browser.

Re:Breaking up with JavaScript front ends by cies on Sunday December 11, 2022 @08:16AM (#33942882)
Now lets compare it to Qt and QML? They seem to be pretty stable GUI libs
Re:Breaking up with JavaScript front ends by bufordtwain on Saturday December 10, 2022 @06:58PM (#33938393)
I find it funny that the library that you think is helping to stabilize the front-end is called "NextJS".
Re:Breaking up with JavaScript front ends by arcturus17 on Saturday December 10, 2022 @07:18PM (#33938538)
It's becoming a standard, and yes, I personally like it. There's plenty of other great choices if you don't like it.

And even some of the up and coming libs, like SolidJS, feel stable compared to the 2010's - they add incremental improvements but keep things that some people really like, like JSX. In the early to mid 2010's everyone was reinventing the wheel constantly.

Re:Breaking up with JavaScript front ends by deepsun on Sunday December 11, 2022 @01:01AM (#33940526)
Everyone says their favorite library "is becoming standard". The rest depends on marketing budgets.
Re:Breaking up with JavaScript front ends by arcturus17 on Sunday December 11, 2022 @02:43AM (#33941098)
Do you have any real commentary against Next.js not being standard, or only generic snide and feelings of superiority directed at "everyone" but yourself?

I'll share a few facts about Next.js:

- Their showcase: https://nextjs.org/showcase#all. The number of super-scale websites using it speaks for itself (doesn't include among others Walmart, which another commenter pointed as an example of how terrible Next.js, but which I've found to be surprisingly good)

- Explosive growth in the 2021 State-of-JS from 2017-2021, with 91% purported retention

- The core tech, React, is voted by far the most commonly used front-end framework in SO dev survey 2021, and 4th most loved. You would never guess by reading HN.

Many if not most people building an SSG or SSR site in React are going to reach for it. If this does not point to a standard then I guess what's only left is to run in circles and argue what a standard is.

Re:Breaking up with JavaScript front ends by sph on Sunday December 11, 2022 @02:48AM (#33941121)
Don't take this the wrong way, but all those impressive figures you've shown don't compare to actual experience. Some of us detractors have 15+ years doing stuff on the Web and we've seen this cycle play out 2 or 3 times. Everything is cool and the best way of animating divs, until it isn't.

I do not like playing the experience card, but when someone tells me React is good and simple, it just tells me they have no idea whatsoever what good and simple has ever been.

And if Next.js is supposed to be a standard, then I might as well quit doing framework at all because it is not a very good library, it just has great marketing, and thrives upon the shoulders of the most common frontend library, React. Sorry to the devs which are often here to PR, but that's how it is. It gets you easily to 80% of the way, the last 20% are really where the issues (bad docs, bugs, constant churn) lie.

Re:Breaking up with JavaScript front ends by arcturus17 on Sunday December 11, 2022 @03:30AM (#33941353)
I built my first website in the late 90's or very early 2000's - I can't even remember. I also think I knew what simple was when users wanted very little interaction. Then in the middle between then and now, building a website with jQuery was a nightmare. So pray, do tell, what you build your websites or web apps in.

> React is good and simple

I in particular never said it was simple. React, particularly in SPA form, starts creating challenges pretty early on in regards to state management and app architecture. But I have never seen solutions to build large SPAs that don't have pitfalls.

In the SSG/SSR realm, I'd argue Next.js is quite simple.

> don't compare to actual experience

> Some of us detractors have 15+ years doing stuff

> I do not like playing the experience card

> it just tells me they have no idea whatsoever

> it just has great marketing

> Sorry to the devs which are often here to PR

> the last 20% are really where the issues (bad docs, bugs, constant churn) lie.

About 80% of your comment is how much better, experienced and genuine you are than everyone else - as opposed to us schmucks you accuse of doing "PR", you are here to deliver simple, unadulterated truths. I would've engaged with any technical points you had made, but since there aren't many to speak of, I guess what's only left for me to say is that it's fantastic that you feel so good about yourself.

Re:Breaking up with JavaScript front ends by sph on Sunday December 11, 2022 @04:17AM (#33941573)
I did not mean to say you or any other Next.js users are doing PR.

I meant the actual Next.js core team.

I know that you are telling your unadulterated opinion, just like I am. I am not accusing you of lying, just disagreeing.

Re:Breaking up with JavaScript front ends by sph on Sunday December 11, 2022 @02:41AM (#33941089)
I've heard that the frontend is stabilising since jQuery came out. Now it's the React devs saying it, but this time for real.
Re:Breaking up with JavaScript front ends by arcturus17 on Sunday December 11, 2022 @02:58AM (#33941182)
Nearly 10 years after the release of the library, React is by far the most commonly used framework according to the 2021 SO dev survey. It is also the number 4 most loved. [1]

I'm a React dev as much as I am a Python or C# dev. I reach for tools that I know I can build in and hire for. It's been years since I use React with a single command line to kickstart a CRA or Next app, and take it from there. Yes, there are pitfalls once you start building anything non-trivial, but so does Django which has been around since 2005 and by virtue of being back-end should be more stable.

Re:Breaking up with JavaScript front ends by sally_glance on Saturday December 10, 2022 @06:51PM (#33938339)
Your choice of examples got me interested - because mine would be similar. Would you recommend something else? Besides Material UI I wouldn't recommend any React-based UI framework (Tailwind is only CSS, solid pick with React nonetheless). I would not recommend NextJS without context, but it is to my knowledge the most mature full-stack React-based framework.