appleboy / appleboy/react-recaptcha

Invisible recaptcha: recaptcha widget doesnt execute.

Open
#252 7 comments 15 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
643
Forks
96
PR merge metrics
No merged PRs in 30d

Description

Im following every step in the documentation for the invisible recaptcha. But i cant get the recaptcha widget to execute programmatically. because i think the recaptchaInstance is still undefined. And the recaptcha badge also doesnt show up. I'm just copy and paste the code from the documentation but still somehow cant get it to work. Really appreciate everyone for help. Here's my code:

```
import React from 'react'
import Link from 'gatsby-link'

import Recaptcha from 'react-recaptcha'
let recaptchaInstance

class FeatureSection extends React.Component {

executeCaptcha = () => {
recaptchaInstance.execute();
}
verifyCallback = (response) => {
if(response){
console.log(response);
// document.getElementById("mc-embedded-subscribe-form").submit();
}
}

render(){
return (


Subscribe


Subscribe to our newsletter for updates on beta testing and our release date








this.executeCaptcha()}
name="subscribe" id="mc-embedded-subscribe"
>
Subscribe

recaptchaInstance = e}
sitekey="#"
size="invisible"
verifyCallback={() => this.verifyCallback()}
/>










)
}
}

export default FeatureSection
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.