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

react-google-recaptcha-hook

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-google-recaptcha-hook - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

19

package.json
{
"name": "react-google-recaptcha-hook",
"description": "",
"keywords": [],
"description": "React Hook for Google reCAPTCHA v3",
"repository": {
"type": "git",
"url": "https://github.com/bhbs/react-google-recaptcha-hook.git"
},
"homepage": "https://github.com/bhbs/react-google-recaptcha-hook",
"bugs": {
"url": "https://github.com/bhbs/react-google-recaptcha-hook/issues"
},
"keywords": [
"react",
"react18",
"hooks",
"recaptcha"
],
"author": "bhbs <bhbstar.me@gmail.com>",
"license": "MIT",
"version": "0.0.2",
"version": "0.0.3",
"files": [

@@ -9,0 +22,0 @@ "dist",

> **Warning**
> Use https://github.com/t49tran/react-google-recaptcha-v3 if your React version is under 18.
# React Hook for Google Recapcha V3
# React Hook for Google reCAPTCHA V3

@@ -20,3 +20,3 @@ https://www.google.com/recaptcha/intro/v3.html

const YourComponent = () => {
const { executeGoogleRecaptcha } = useGoogleReCaptcha(`${YOUR_SITE_KEY}`, {
const { executeGoogleReCaptcha } = useGoogleReCaptcha(`${YOUR_SITE_KEY}`, {
language: `${LANGUAGE_CODE}`, // optional, https://developers.google.com/recaptcha/docs/language

@@ -36,1 +36,24 @@ enterprise: `${BOOLEAN}`, // optional, true if you want use enterprise edition

```
## Example
```javascript
import { useGoogleReCaptcha } from "react-google-recaptcha-hook";
const YourComponent = () => {
const { executeGoogleReCaptcha } = useGoogleReCaptcha("ABCDEFG123456");
const postComment = useCallback(async () => {
const token = await executeRecaptcha("postComment");
fetch("/api/echo", {
method: "POST",
body: JSON.stringify({
comment: "hello",
token,
}),
});
}, []);
return <button onClick={postComment}>POST</button>;
};
```
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