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

Rendering the same form twice on the page gives a captcha already been rendered error

Open sschenk opened this issue 7 years ago • 5 comments

I have a form that appears on the page but might appear/get rendered again on the same page when a user clicks a modal button.

The problem is that I get the following error if that form is being rendered twice on the page:

Error: reCAPTCHA has already been rendered in this element at Object.Hr [as render]

How do I solve this?

sschenk avatar Mar 28 '18 09:03 sschenk

@sschenk Use elementID prop and give each captcha a different elementID. This will let you have multiple captcha instances on a page at the same time.

hbowden avatar Apr 19 '18 15:04 hbowden

I had the errror when using with Gatsby in production mode. The solution was to not render the component in SSR mode.

slorber avatar Jun 17 '19 09:06 slorber

@slorber Can you explain a bit more?

dimitrisnl avatar Jun 18 '19 10:06 dimitrisnl

Hi

I just did {isBrowser & & <Recaptcha/>} and it solved my issue. Didn't investigate more

slorber avatar Jul 01 '19 06:07 slorber

Thanks @slorber! That worked for me.

bartimaeus avatar Oct 10 '19 00:10 bartimaeus