Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-google-recaptcha-v3

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-google-recaptcha-v3

React component for google-recaptcha v3

  • 1.10.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
252K
increased by1.7%
Maintainers
1
Weekly downloads
 
Created

What is react-google-recaptcha-v3?

The react-google-recaptcha-v3 npm package is a React component wrapper for Google reCAPTCHA v3, which helps protect your website from spam and abuse while letting real users pass through with ease. It provides a simple way to integrate Google reCAPTCHA v3 into your React applications.

What are react-google-recaptcha-v3's main functionalities?

Loading reCAPTCHA

This code demonstrates how to load the Google reCAPTCHA v3 script by wrapping your application with the GoogleReCaptchaProvider component and providing your reCAPTCHA site key.

import React from 'react';
import { GoogleReCaptchaProvider } from 'react-google-recaptcha-v3';

const App = () => (
  <GoogleReCaptchaProvider reCaptchaKey="your-recaptcha-key">
    <YourComponent />
  </GoogleReCaptchaProvider>
);

export default App;

Executing reCAPTCHA

This code demonstrates how to execute the reCAPTCHA verification process within a component using the useGoogleReCaptcha hook. The executeRecaptcha function is called to get the reCAPTCHA token.

import React, { useEffect } from 'react';
import { useGoogleReCaptcha } from 'react-google-recaptcha-v3';

const YourComponent = () => {
  const { executeRecaptcha } = useGoogleReCaptcha();

  useEffect(() => {
    const handleReCaptchaVerify = async () => {
      if (!executeRecaptcha) {
        console.log('Execute recaptcha not yet available');
        return;
      }
      const token = await executeRecaptcha('homepage');
      console.log(token);
    };

    handleReCaptchaVerify();
  }, [executeRecaptcha]);

  return <div>Your Component</div>;
};

export default YourComponent;

Other packages similar to react-google-recaptcha-v3

FAQs

Package last updated on 10 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc