4 ms·
> The snippet above was called as a server function. This is React's new way of calling server side code from the client side. Tangential to the post, but mixi
by mzajc 1y ago
> The snippet above was called as a server function. This is React's new way of calling server side code from the client side.
Tangential to the post, but mixing client-side and server-side code sounds like a recipe for disaster. There are already one too many services that perform authorization client-side, and I have a feeling making it harder to tell what runs where only makes the situation worse.
- mexicocitinluez 1y agoDoesn't the 'use client'/'use server' directives tell you this?
- chrysoprace 1y agoIt's in the pursuit of type inference and developer ergonomics. The problem without them in this day and age is how do you get your backend and frontend types in sync? You can manually update your types but this is tedious and prone to error (this is what we do at work), but having type errors immediately flagged on the client when you try to use a property wrong _is nice_. The problem in this case is that it's so opaque that you have other issues like this one. Server Functions are unfortunately a low-level API in React and so their actual implementation is left up to frameworks.