react-google-recaptcha-hook
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"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>; | ||
}; | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
9025
0
2
58
0