onChange 函数
let captcha;
onchange 函数
function onchange(value) {
window.value.reset();
}
const setCaptchaRef = (ref) => {
if (ref) {
return captcha = ref;
}
};
const resetCaptcha = () => {
// maybe set it till after is submitted
captcha.reset();
}
reCaptcha 组件内部。
<ReCAPTCHA sitekey="" ref={(r) => setCaptchaRef(r)} onChange={onChange(() => resetCaptcha())} />