Merge pull request #15586 from pschaub/patch-1

fix: onSuccess prop in Turnstile captcha docs
This commit is contained in:
Copple authored and GitHub committed 2023-07-06 02:44:30 -07:00
commit 8bd0c52c49
1 file changed
+3 -3
+3 -3
View File
@@ -165,18 +165,18 @@ Let's create an empty state to store our `captchaToken`
const [captchaToken, setCaptchaToken] = useState()
```
Now lets add the Cloudflare Turnstile component to the JSX section of our code
Now lets add the Cloudflare Turnstile component to the JSX section of our code:
```html
<Turnstile />
```
We will pass it the sitekey we copied from the Cloudflare website as a property along with a `onVerify` property which takes a callback function. This callback function will have a token as one of its properties. Let's set the token in the state using `setCaptchaToken`
We will pass it the sitekey we copied from the Cloudflare website as a property along with a `onSuccess` property which takes a callback function. This callback function will have a token as one of its properties. Let's set the token in the state using `setCaptchaToken`:
```jsx
<Turnstile
sitekey="your-sitekey"
onVerify={(token) => { setCaptchaToken(token) }
onSuccess={(token) => { setCaptchaToken(token) }
/>
```