4 ms·
I just looked into the Server Actions documentation. Why is there a 'use server' inside the action if it's already running on the server? What happens if this i
by dbbk 3y ago
I just looked into the Server Actions documentation. Why is there a 'use server' inside the action if it's already running on the server? What happens if this is omitted? Why is all of this stuff so opaque?
https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions#actions https://nextjs.org/docs/app/building-your-application/data-f...
- beardedetim 3y agoI think, if I'm recalling it correctly, that the component that is defining it in the docs can be either client or server and by marking the functiom as server only, Next knows to do magic.
- dbbk 3y agoNext may know that but developers sure won't.
- TechBro8615 3y agoThis kind of noodley bundling opt-out is also extremely dangerous from a security perspective. I expect there are a lot of Next.js apps leaking code and possibly secrets that should only be available on the server.