Overview
The Vouch React SDK provides hooks and components for seamless email validation in React applications with automatic device fingerprinting.Package:
@vouch-in/react
React Version: 16.8+ (hooks required)
TypeScript: Full type definitions includedInstallation
Quick Start
VouchProvider
Wrap your app withVouchProvider to enable Vouch throughout your component tree:
Props
string
required
Your Vouch project ID
string
required
Your client API key
object
Optional configuration:
endpoint- API endpoint URL (default: “https://api.vouch.expert”)apiVersion- API version number or “latest” (default: “latest”)
useValidateEmail()
Primary hook for email validation:Return Values
function
Function to validate an email. Returns the validation response.
boolean
Whether validation is in progress
ValidationResponse | null
Validation response (null if not yet validated). Contains
checks, metadata, recommendation, and signals.Error | null
Error if validation failed
function
Reset state to initial values
ValidationResponse Type
The
message field contains a human-friendly error message when the recommendation is flag or block (e.g. “Please use a permanent email address, not a temporary one.”). It is null when the recommendation is allow.useVouch()
Access the Vouch instance directly:useFingerprint()
Hook to generate and access device fingerprint:Complete Examples
Full Signup Form
Real-time Validation
TypeScript
Next.js Integration
Best Practices
Wrap at Root Level
Wrap at Root Level
Place
VouchProvider at your app’s root for consistent access:Handle Loading States
Handle Loading States
Always show loading feedback during validation:
Reset After Submit
Reset After Submit
Clear validation state after successful submission:
Debounce Real-time Validation
Debounce Real-time Validation
Avoid validating on every keystroke:
Next Steps
Next.js SDK
Next.js-specific integration
JavaScript SDK
Vanilla JavaScript SDK
Best Practices
Production optimization
API Reference
Complete API docs