Package installation
Install the library using your preferred package manager:Peer dependencies
The library requires React and React DOM as peer dependencies. Make sure you have compatible versions installed:package.json
The library supports React 16.3+ (for Context API support), React 17, React 18, and React 19.
Get a reCAPTCHA key
Before you can use the library, you need to obtain a site key from Google:Visit the reCAPTCHA admin console
Go to https://www.google.com/recaptcha/admin and sign in with your Google account.
Configure your site
- Label: Give your site a descriptive name
- reCAPTCHA type: Select reCAPTCHA v3
- Domains: Add your domain(s). For development, include
localhost - Accept the reCAPTCHA Terms of Service
Environment variables (recommended)
Store your reCAPTCHA site key in environment variables for better security and configuration management:Environment variables must be prefixed with:
REACT_APP_for Create React AppVITE_for ViteNEXT_PUBLIC_for Next.js
TypeScript support
The library includes TypeScript type definitions out of the box. No additional@types package is needed.
Verification
Verify your installation by importing the provider:App.tsx