dozoisch / react-google-recaptcha

Component wrapper for Google reCAPTCHA
MIT License
1.03k stars 142 forks source link

How to reset captcha #21

Closed gmarquesetr closed 8 years ago

gmarquesetr commented 8 years ago

How can I reset the captcha?

I'm render it like these: <ReCAPTCHA ref="recaptcha" sitekey="xxxxxxxxx" onChange={this.onCaptchaChange} />

I know I can do something like grecaptcha.reset() but I can't understand how I do this:

var grecaptchaObject = grecaptcha // You must provide access to the google grecaptcha object.

Thank you :)

dozoisch commented 8 years ago

Hi! if you have a ref on the component you can do

this.refs.recaptcha.reset()

The function is exposed! See https://github.com/dozoisch/react-google-recaptcha#component-api