Next.js Discord

Discord Forum

useFormStatus with no exclusive component for button

Unanswered
Siberian posted this in #help-forum
Open in Discord
SiberianOP
Hello. Im writing simple login page where I have a form component in which I have a form (with server action) and I want my button to change text from login to loading on button click.

I tried using useState but it would update state after function is completed

Now im trying useFormState and useFormStatus but the second one is working only when I extract button itself while with 1st one I haven't figured it out yet


Also I guess using formAction is prefered instead of useState inputs and onSubmit?

0 Replies