google recaptcha

v3

The Google reCAPTCHA v3 returns a score for each request without user friction. The score is based on interactions with your site and enables you to take an appropriate action for your site.

Demo

Provider Setup

All reCAPTCHA functionality requires wrapping your application with the GoogleReCaptchaProvider. This provider manages the reCAPTCHA script loading and provides context to child components.

import React from 'react';
import {  } from '@google-recaptcha/react';

export const  = () => (
  < ='v3' ='your_site_key'>
    ...
  </>
);

Usage

Google ReCaptcha v3 returns a score for each request without user friction. The score is based on interactions with your site and enables you to take an appropriate action for your site.

import React from 'react';
import {  } from '@google-recaptcha/react';

const  = () => {
  const  = ();

  const  = async () => {
    if (!.) {
      .('Execute recaptcha not available');
      return;
    }

    const  = await .('some action');
  };

  return < ={}>verify</>;
};

Enterprise Mode

Google reCAPTCHA Enterprise provides enhanced security features, advanced analytics, and better customization options for businesses. It offers improved bot detection, detailed risk analysis, and enterprise-grade support.

<GoogleReCaptchaProvider type='v3' siteKey='your_enterprise_site_key' isEnterprise>
  <App />
</GoogleReCaptchaProvider>

After enabling enterprise mode, you can use the executeV3 function to set some actions for better risk assessment.

import React from 'react';
import {  } from '@google-recaptcha/react';

const  = () => {
  const  = ();

  const  = async () => {
    if (!.) {
      .('Execute recaptcha not available');
      return;
    }

    const  = await .('some action');
  };

  return < ={}>verify</>;
};