Live data from Hacker News

Write PHP Code Within Next.js Components

github.com

51–60 of 107 posts

Re: Write PHP Code Within Next.js Components

#52

It's funny, but all you see here and on Twitter are cheap shot one liners, many of these people have never even used Next.js. I find server actions combined with RSC to be incredibly useful and powerful. Easily define and call a type safe function from client to server with zero overhead. No API boilerplate, fetch, tRPC anything.. You just define a function and call it, very nice. Type safety, code completion, refact…

> Not sure why it's being compared to PHP

probably just because PHP is now recognized widely as fundamentally bad design. Its just that many people who came late to the party never really knew why, so they think to themselves, no this is actually great "no API boilerplate, fetch, tRPC anything.. You just define a function and call it, very nice.".

And so the cycle continues...

Re: Write PHP Code Within Next.js Components

#53
post #49

Earlier quoted context omitted.

Can you elaborate on why Astro is better or what type of fight with Next? Your type of post with strong opinions but none of the underlying _reasons_ are one of the reasons why JS framework wars are tiring. I'm really interested in alternatives to Next, but it's difficult to good, non-vitriolic, shop talk. We bolted Next onto the React/Python application at work for SEO stuff. There's a number of self-inflicted probl…

What direction would you prefer Vercel went in?

[dead]

Re: Write PHP Code Within Next.js Components

#54
post #39

Earlier quoted context omitted.

The JS part should be removed first. No sarcasm... :)

Who would win? A literal trillion dollar ecosystem ... vs. ... le edgy joke.

All these haters of Javascript, you'd think no one actually uses it.

Re: Write PHP Code Within Next.js Components

#55
post #50

Earlier quoted context omitted.

What part of php? php doesnt render on the client, and most php apps except for livewire don't integrate call backs to the server.

"act like" here meaning DX, not actual behavior. Magical actions within UI code.

I mean doesn’t asp, python, ruby, JavaScript, etc.. all have templating languages you can do fun things in?

Re: Write PHP Code Within Next.js Components

#56
post #36

Earlier quoted context omitted.

I get what you’re saying, but you can use React without RSC just fine. Next.js might be pushing RSC, but using Vite and normal React is fine. Hell, even the pages directory still works in Next.js and it has no RSC.

I would argue that unless your need SEO there is no reason to reach for Next.js or any other react framework. The default should be vite and client only. Everything else only serves corporate interests.

From my experience, Next isn't great for SEO either.

Try setting up a redirect that preserves query params with server components.

Server components do allow redirects on the server-side, but they do not expose query params.

It's technically possible with middleware (single root file that runs for every request), or by setting up a client-side redirect, but that's not ideal.

Re: Write PHP Code Within Next.js Components

#58
Ironically, these days PHP has its act together - look at Laravel - better than most of the JS ecosystem does.

I don’t mind JS as a core language. Web Browser APIs are pretty awesome (with a few notable exceptions like IndexedDB). But the Node and SPA ecosystem is, speaking objectively, a dumpster fire.

We parody “enterprise” software, where vendors convince large companies to invest in over-engineered garbage.

Node, Express, React, Vue, etc. used to be for hipsters who wanted to cobble something together with maximum velocity and flexibility. But with them now in the big leagues, we’re seeing the same “enterprise” patterns emerge.

This is not an inevitable part of “growing up”; Python/Django and Ruby/Rails have been around for two decades, powered various unicorns, and are used at old-school multinational corporations as well as tech behemoths. But they have not fallen victim to the nonsense that plagues the JS ecosystem.

In fact, a lot of the JS ecosystem is now the worst of both worlds; you have over-engineered “solutions” combined with outrageous churn and zero sense of direction.

Re: Write PHP Code Within Next.js Components

#59

It's funny, but all you see here and on Twitter are cheap shot one liners, many of these people have never even used Next.js. I find server actions combined with RSC to be incredibly useful and powerful. Easily define and call a type safe function from client to server with zero overhead. No API boilerplate, fetch, tRPC anything.. You just define a function and call it, very nice. Type safety, code completion, refact…

> Not sure why it's being compared to PHP probably just because PHP is now recognized widely as fundamentally bad design. Its just that many people who came late to the party never really knew why, so they think to themselves, no this is actually great "no API boilerplate, fetch, tRPC anything.. You just define a function and call it, very nice.". And so the cycle continues...

What do you think is fundamentally bad about PHP exactly? It powers a large percentage of the web and does it quite well.

Re: Write PHP Code Within Next.js Components

#60
post #45
post #43

For those not in on the origin of the joke, Next.js introduced "server actions" which became a huge meme / debate topic on Twitter - for example, https://twitter.com/peer_rich/status/1717609270475194466 This is presumably inspired by all of the people saying Next is turning into PHP.

Next has always been inspired by PHP. in his keynote Rauchg even spent like a moment of silence dedicated to the PHP Lambo, completely out of context. it must have been confusing to others not in on the joke but for those of us in the audience it was great

Isn't PHP Laravel author owner of a Lambo? I wonder what the plate reads.
Post reply on HN