Skip to content

useOtpCredential ​

browser
test coverage
Last changed: 13 days ago

TIP

This hook uses navigator.credentials browser api to provide enhanced functionality. Make sure to check for compatibility with different browsers when using this api

Hook that creates an otp credential

typescript
import { useOtpCredential } from '@siberiacancode/reactuse';

Usage ​

typescript
useOtpCredential((credential) => console.log(credential));
// or
useOtpCredential({ onSuccess: (credential) => console.log(credential), onError: (error) => console.log(error) });

Demo ​

Api ​

Parameters

NameTypeDefaultNote
callbackUseOtpCredentialCallback-The callback function to be invoked

Parameters

NameTypeDefaultNote
params.onSuccessUseOtpCredentialCallback-The callback function to be invoked on success
params.onErrorUseOtpCredentialCallback-The callback function to be invoked on error

Source ​

Source • Demo

Contributors ​

Avatardebabin

Released under the MIT License.