Live data from Hacker News

Write PHP Code Within Next.js Components

github.com

21–30 of 107 posts

Re: Write PHP Code Within Next.js Components

#24
post #18

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…

They're really cool, and act like the best parts of PHP. I actually miss the simply powerful aspect of the paradigm.

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.

Re: Write PHP Code Within Next.js Components

#25
post #20

> I hope I don't have to say this but: If you even in the slightest consider to use this in any application at all you are an absolute madman and and should be locked out of the internet for the rest of your life, I hope you find some other fun activity, maybe gardening or woodwork.

I know. The Next.js part should definitely be removed first. /s

Re: Write PHP Code Within Next.js Components

#26
post #19

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…

i just wanna add here on a serious note that i also see a use cases for "server actions", but i do not primarily write next.js or react so i didn't have an opportunity to try them out yet. I think it's important to know what you would use them for. I don't think core business logic should be there, but I see why you would use them for f.e. signing something that would require a secret you don't want to have on the cl…

I could take this php example or raw sql code and put it in the body of an API call from the client.

Are API calls bad now? Same thing. A misunderstood example.

Re: Write PHP Code Within Next.js Components

#27
post #20

> I hope I don't have to say this but: If you even in the slightest consider to use this in any application at all you are an absolute madman and and should be locked out of the internet for the rest of your life, I hope you find some other fun activity, maybe gardening or woodwork.

I know. The Next.js part should definitely be removed first. /s

No sarcasm.

Re: Write PHP Code Within Next.js Components

#28
post #16

I think part of what makes these recent gags so funny to me is that it illustrates how perilous mixing RSC with client code feels in practice. Worrying about teammates accidentally exposing environment variables was already bad enough. Debugging is now even more troublesome, and for what? So we can use some XML-like syntax everywhere? React serves a purpose but this doesn't feel like it. All these directives, the loo…

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.
Post reply on HN