react-google-recaptcha icon indicating copy to clipboard operation
react-google-recaptcha copied to clipboard

Possible to make execute function Promise-based?

Open joetidee opened this issue 7 years ago • 2 comments

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>
    )
  );
}

joetidee avatar Feb 24 '18 00:02 joetidee

I hope this issue have solution please it will be kind us

fmandres92 avatar Nov 19 '19 18:11 fmandres92

PR'd 👍

stemsmit avatar Jan 19 '20 03:01 stemsmit