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

Unable to reset after successful form submission

Open shakyasaijal opened this issue 4 years ago • 2 comments

"react-google-recaptcha": "^2.0.1"

Method 1:

`const Contact = () => { const recaptchaRef = React.createRef();

const verifyCallback = () => { console.log( recaptchaRef.current.getValue() ) } return(

<ReCAPTCHA sitekey="key" onChange={verifyCallback} theme="dark" ref = {recaptchaRef} />
); }`

Method 2:

`const Contact = () => { let recaptchaRef;

const verifyCallback = () => { console.log( recaptchaRef) } return(

<ReCAPTCHA sitekey="key" onChange={verifyCallback} theme="dark" ref = {e => recaptchaRef = e} />
); }`

Both method gave null.

shakyasaijal avatar Apr 12 '20 13:04 shakyasaijal

same issue

armspkt avatar Apr 23 '20 05:04 armspkt

const recaptchaRef = useRef(null);

const handleSubmit = () => { ..... recaptchaRef.current.reset(); } ..... <ReCAPTCHA ref={recaptchaRef} sitekey={RECAPTCHA_KEY} onChange={onChange} />

Mrjacint avatar May 05 '20 21:05 Mrjacint