Manages resend actions, such as resending a verification code, on ACUL screens.The hook:
- Tracks the remaining cooldown time.
- Reports whether the resend button should be disabled.
- Provides a
startResend()function that triggers a resend and starts the cooldown. - Stores the countdown in
localStorage, so the countdown persists across the page reload that a resend causes.
Parameters
Optional configuration, for example
timeoutSeconds and onTimeout.Returns
UseResendReturnAn object with:remaining— seconds left until the next resend is permitted.disabled—trueif resending is currently blocked.startResend— triggers a resend immediately, if resending is allowed.
Supported Screens
email-identifier-challengeemail-otp-challengelogin-email-verificationlogin-passwordless-email-codelogin-passwordless-sms-otpmfa-email-challengemfa-sms-challengemfa-voice-challengephone-identifier-challengereset-password-mfa-email-challengereset-password-mfa-sms-challengereset-password-mfa-voice-challenge
Example
Remarks
- The underlying
ResendControlhas no explicit teardown method; the hook does not require manual cleanup. - The hook re-initializes the resend manager if
timeoutSecondsoronTimeoutchange.