简体   繁体   English

React createRef()不会在Netlify部署上触发

[英]React createRef() does not trigger on Netlify Deployment

I am implementing an invisible google recaptcha using the react-google-recaptcha package. 我正在使用react-google-recaptcha包实现隐形的Google Recaptcha。 Everything works fine locally, all is trigerred and works smoothly but when deployed on Netlify, when you click the button the flow stops on the recaptchaRef.current.execute(). 一切在本地都可以正常工作,所有组件都可以触发,并且可以流畅地运行,但是当部署在Netlify上时,当您单击按钮时,流程将在recaptchaRef.current.execute()上停止。

These are the main parts of the code: 这些是代码的主要部分:

 const recaptchaRef = React.createRef(); class App extends Component { triggerRecaptcha = () => { recaptchaRef.current.execute(); } handleChange = () => { // verify recaptcha } render() { return ( <React.Fragment> <ReCAPTCHA ref={recaptchaRef} sitekey={KEY} onChange={this.handleChange} size="invisible" /> <button type="button" onClick={this.triggerRecaptcha}>Proceed</button> </React.Fragment> ) } } 
 <script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script> 

Basically locally the handleChange will be trigerred. 基本上在本地handleChange将被触发。 On Netlify it is not, and after debugging it seems that the issue on the deployed version is recaptchaRef.current.execute(); 在Netlify上不是,在调试后,似乎已部署版本的问题是recaptchaRef.current.execute() ;。

Any one has any clue what is happening? 任何人都知道发生了什么事吗?

Thanks 谢谢

This involved Recaptcha admin console not being configured correctly. 这涉及Recaptcha管理控制台配置不正确。 Sorry for time lost and thanks @UjinT34 抱歉浪费时间,谢谢@ UjinT34

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM