New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@types/react-google-recaptcha

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/react-google-recaptcha

TypeScript definitions for react-google-recaptcha

  • 2.1.9
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
380K
increased by2.97%
Maintainers
1
Weekly downloads
 
Created

What is @types/react-google-recaptcha?

@types/react-google-recaptcha provides TypeScript definitions for the react-google-recaptcha package, which is a React component wrapper for Google reCAPTCHA. This package allows developers to easily integrate Google reCAPTCHA into their React applications with type safety.

What are @types/react-google-recaptcha's main functionalities?

Rendering reCAPTCHA

This feature allows you to render a Google reCAPTCHA widget in your React component. You can specify the site key and handle the onChange event to capture the reCAPTCHA value.

import ReCAPTCHA from 'react-google-recaptcha';

function MyComponent() {
  const recaptchaRef = React.createRef();

  return (
    <ReCAPTCHA
      ref={recaptchaRef}
      sitekey="your-site-key"
      onChange={(value) => console.log('Captcha value:', value)}
    />
  );
}

Executing reCAPTCHA programmatically

This feature allows you to execute the reCAPTCHA programmatically, which is useful for invisible reCAPTCHA. You can call the execute method on the reCAPTCHA ref to trigger the verification process.

import ReCAPTCHA from 'react-google-recaptcha';

function MyComponent() {
  const recaptchaRef = React.createRef();

  const handleClick = () => {
    recaptchaRef.current.execute();
  };

  return (
    <div>
      <ReCAPTCHA
        ref={recaptchaRef}
        sitekey="your-site-key"
        size="invisible"
        onChange={(value) => console.log('Captcha value:', value)}
      />
      <button onClick={handleClick}>Verify</button>
    </div>
  );
}

Resetting reCAPTCHA

This feature allows you to reset the reCAPTCHA widget programmatically. You can call the reset method on the reCAPTCHA ref to reset the widget and clear the current response.

import ReCAPTCHA from 'react-google-recaptcha';

function MyComponent() {
  const recaptchaRef = React.createRef();

  const handleReset = () => {
    recaptchaRef.current.reset();
  };

  return (
    <div>
      <ReCAPTCHA
        ref={recaptchaRef}
        sitekey="your-site-key"
        onChange={(value) => console.log('Captcha value:', value)}
      />
      <button onClick={handleReset}>Reset</button>
    </div>
  );
}

Other packages similar to @types/react-google-recaptcha

FAQs

Package last updated on 23 Jan 2024

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