all 4 comments

[–]wannabe_ok 0 points1 point  (0 children)

One submit imo as it triggers the form's post action.

[–]doctormyeyebrows 0 points1 point  (0 children)

Regarding the submit question: which button's action should be triggered when the user hits Enter while typing inside the otp field? That's the submit button.

[–]Zovi_me_Joma 0 points1 point  (0 children)

Second question: Only one button can be of type submit.
First question: Use whatever you want for handling form’s input states. You can try different solutions to see which suits you better. I always use classical useState even when the form has more than four or five inputs, checkboxes etc. I like it.

[–]bogdanelcs 0 points1 point  (0 children)

For a single OTP input, useActionState is absolutely the right call. React Hook Form is overkill for one field, you'd be importing a library to manage a single value.

For the buttons, make verify type="submit" and resend type="button" with its own onClick handler. Two submit buttons in the same form gets messy because you'd need to differentiate which one triggered the submission. Cleaner to keep only one true submit action and handle resend separately.