Replies: 1 comment
-
Actions defined using next-safe-action are just regular functions with input validation. They can be called from the server too, obviously without using hooks. Have you found problems while doing so? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I realize that
next-safe-actions
is meant to provide a way to call server actions from the client.I'm looking for ideas for how to structure my code such that I only have to write a server function once, and then be able to call it from both the server and from the client using next-safe-action.
I realize I can call a classic server action (not wrapped in
next-safe-action
) both ways, from the server and from the client. But I would like to keep all the benefits of next-safe-actions (e.g. loading states, callbacks)...It feels wrong to write every function twice: Example
Beta Was this translation helpful? Give feedback.
All reactions