在这里输入图像描述请看看img,我试着用它,但它不起作用,我不明白为什么
<Formik
initialValues={{email: "", password: "", firstname: "",
lastname: "", passwordConfirm: ""}}
onSubmit={(values, {setSubmitting}) => {
console.log(values);
// Send a POST r`enter code here`equest
axios.post('http://212.42.212.29:3001/auth/register', values, {
"headers": {
"content-type": "application/json",
}
}).then(function (response) {
console.log(response);
}).catch(function (error) {
console.log(error.response);
});
}}
>
我的错误是在Formik中,我错误地写了值名
<Formik
initialValues={{email: "", password: "", firstname: "", lastname: "",
passwordConfirm: ""}}
>
**应为**
<Formik
initialValues={
{email: "",
password: "",
**firstName: "",**
**lastName:""**,
passwordConfirm: ""}}
>