-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update 02-server-actions-and-mutations.mdx #64248
Conversation
mistake in the docs. action should not be apply on the button. only formAction or onClick is allow.
@aktoriukas Thanks for the catch! Let's use |
adding `onClick` instead of the `formAction` as per `samcx` request. also adding `'use client'` as to use `onClick` component has to be client component.
ok @samcx , adding also adding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samcx just for curiosity and learning, why did you suggest to use |
@@ -928,11 +929,12 @@ export default function Page() { | |||
... | |||
} | |||
|
|||
return <button action={publish}>Publish</button>; | |||
return <button onClick={publish}>Publish</button>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samcx
onClick
passes MouseEvent
param not FormData
. formAction
was correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@A7med3bdulBaset Thanks for the correction, will update!
Improving Documentation
mistake in the docs.
action should not be apply on the button.
only formAction or onClick is allow.