5 ms·
I've been out of the node community for over 5 years but this seems in line with the "hurr durr use javascript for everything!!" crew. can someone tell me if th
by cultofmetatron 3y ago
I've been out of the node community for over 5 years but this seems in line with the "hurr durr use javascript for everything!!" crew. can someone tell me if this is a parody cuz I seriously can't tell anymore?
- nicoburns 3y agoThis one is definitely a parody / not a serious project.
- elnardu 3y agotbh, I sometimes cannot tell if real js projects are parodies
- flykespice 3y ago> can someone tell me if this is a parody cuz I seriously can't tell anymore? You just don't use javascript enough in your life.
- cultofmetatron 3y agowell you're not wrong haha. I switched to elixir for my startup so I haven't touched a javascript file in almost 4 years now. I don't feel like I'm missing much though.
- bambam24 3y ago[dead]
- junon 3y agoTL:DR it's a meme. The context here (as I understand it) is that Next.js, a popular React-like framework that allows (in a way) coding both the server and browser portions of a web app in one codebase, such that each portion is extracted at runtime and automatically wired up via API calls. This is a simplification but it's how you can think of it. They've now introduced an even tighter way of introducing server code into what are otherwise frontend React components by piggie backing off the old "use strict" directive syntax, called "use server", allowing you to interleave - directly and inline - the client and browser code. Many a meme have been created, half-jokingly comparing it to PHP, ranging from the supportive jest, to the very seriously critical, as one would expect the internet to do. Some of those memes have been in the form of "use ___", such as "use binary", "use php", etc. I don't use frontend frameworks much these days so maybe someone can correct me on some of this, but hopefully this helps explain it a bit. https://nextjs.org/docs/app/api-reference/functions/server-actions https://nextjs.org/docs/app/api-reference/functions/server-a...
- elnardu 3y agoPretty much this!
- dackerlunghack 3y ago[dead]
- sophiebits 3y agoOne clarification: client and server code are never mixed within the same file. "use server" can only be used in server files and marks code that the client can call back into.
- _lvbh 3y agoI think they introduced some weird mixing in the NextJS conference that just occurred recently. I don’t understand it enough to be sure though.
- cal85 3y agoYes, they demo'd a component with an onClick callback that contained a 'use server' directive followed by serverside SQL query, right there in the onClick. So presumably that callback is automatically replaced at build time with some generated clientside code that posts to a dynamic endpoint generated from just that function, or something. Seems like a strange idea with lots of ways to go wrong, but I don't know enough about it to judge.
- deleted 3y ago[deleted]