react-google-recaptcha
react-google-recaptcha copied to clipboard
Possible to make execute function Promise-based?
I have a parent component to the component that actually uses the invisible recaptcha facility. In my case (below) the onSubmit
and onChange
functions are passed down from this parent component, so how do I get the value returned by captcha.execute()
into the onSubmit
function so that I can include it in the request payload sent to my server:
// Child component.
var React = require("react").default;
var render = require("react-dom").render
var ReCAPTCHA = require("react-google-recaptcha");
class Child extends React.Component {
...
render(
return (
<form onSubmit={this.props.onSubmit}}>
<ReCAPTCHA
ref={(el) => { this.captcha = el; }}
size="invisible"
sitekey="Your client site key"
onChange={this.props.onChange}
/>
</form>
)
);
}
I hope this issue have solution please it will be kind us
PR'd 👍