Replies: 1 comment 1 reply
-
v7 supports bind arguments, see related docs here. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Let's say I have a simple server action that takes
postId
andmessage
as payload:And let's say I have a simple form component that collects the message input prop that gets called on form submit event with the
message
entered by the user, I would need to, as suggested by the docs, split up the parameters and use.bind
to pass thepostId
first, and then use the bound function within the component to pass the message.This however is not going to work if we want to use
next-safe-action
as it only works with a single parameter passed to the action.To solve this problem, I came up with this workaround:
I wanted to see what you all think about this approuch, vs the
.bind
method? Are there some drawbacks to this, or am I perhaps missing something, as to why we should not be doing it this way?Many thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions