如何将reCAPTCHA添加到reactjs表单
我想在我的react表单中添加reCAPTCHA以防止垃圾邮件。我在localhost:3000上使用此表单。我读过关于google recaptcha的文章,但它告诉我要注册一个“.com”域名。这是我的谷歌表格如何将reCAPTCHA添加到reactjs表单,reactjs,recaptcha,Reactjs,Recaptcha,我想在我的react表单中添加reCAPTCHA以防止垃圾邮件。我在localhost:3000上使用此表单。我读过关于google recaptcha的文章,但它告诉我要注册一个“.com”域名。这是我的谷歌表格 import React, { Fragment, useState } from "react"; import axios from "axios"; const Form = () => { const [candidate,
import React, { Fragment, useState } from "react";
import axios from "axios";
const Form = () => {
const [candidate, setCandidate] = useState({
fullName: "",
phoneNumber: 0,
email: "",
gitProfile: "",
linkToResume: "",
designation: "",
interest: "",
});
const onChange = e =>
setCandidate({ ...candidate, [e.target.name]: e.target.value });
const onSubmit = e => {
e.preventDefault();
//axios post request
};
return (
<Fragment>
<form onSubmit={onSubmit}>
//form input fields
</form>
</Fragment>
);
};
export default Form;
import React,{Fragment,useState}来自“React”;
从“axios”导入axios;
常数形式=()=>{
const[candidate,setCandidate]=useState({
全名:“,
电话号码:0,
电邮:“,
gitProfile:“”,
链接摘要:“”,
名称:“,
利息:“,
});
const onChange=e=>
setCandidate({…candidate[e.target.name]:e.target.value});
const onSubmit=e=>{
e、 预防默认值();
//axios post请求
};
返回(
//表单输入字段
);
};
导出默认表单;