Client Component Button inside Form with Server action
Unanswered
West African Lion posted this in #help-forum
West African LionOP
Is it possible to have a client component button in a form that has a server action?
I have a client button that onClick shows a loading state.
Unfortunately it does not work with this button component.
Is there any work around?
I have a client button that onClick shows a loading state.
Unfortunately it does not work with this button component.
Is there any work around?
2 Replies
Yellow-legged Gull
yes it's possible, i do it myself in my current project. im importing a client submit button in a server component that uses a server action for the form.
Yellow-legged Gull
there's actually a very specific example in the docs as well, https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations#pending-states