react-google-recaptcha : Setting window attributes in React-Redux

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


react-google-recaptcha : Setting window attributes in React-Redux



I'm trying to set the recaptcha language dynamically in my application. Looking at the documentation here https://github.com/dozoisch/react-google-recaptcha



In order to translate the reCaptcha widget, you should create a global
variable configuring the desired language. If you don't provide it,
reCaptcha will pick up the user's interface language.


window.recaptchaOptions = {
lang: 'fr'
}



This works if I set the global window.recaptchaOptions object in root app.js file



The issue that I'm trying to resolve is setting the window.recaptchaOptions inside the index.js after creating the store.



Investigating the requests, it looks like the google recaptcha__fr script is pulled in only if I set the global window.recaptchaOptions in the root App. This doesn't allow me to access the store.



Any thoughts on how I can fix this so I can set the window.recaptchaOptions in index.js after creating the store?



Thanks





Is the reCAPTCHA script pulled in even if you don't render a ReCAPTCHA component? If the script isn't loaded until the ReCAPTCHA element is mounted, you could render an empty element in place of the ReCAPTCHA, then mount it once the language has been defined.
– Brett DeWoody
Dec 22 '17 at 9:36


ReCAPTCHA


ReCAPTCHA


ReCAPTCHA





@BrettDeWoody The script isn't loaded until the ReCAPTCHA is rendered. Can you please elaborate the next sentence?
– DisplayName
Dec 22 '17 at 16:35






1 Answer
1



I raised an issue here https://github.com/dozoisch/react-google-recaptcha/issues/67



PR will be merged soon.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results