它给出了一个错误,我不知道为什么,如果你看我的代码,你会看到没有任何问题。 登录路由页面:
const [email, setEmail] = useState("");
<LoginPage
email={email}
setEmail={setEmail} />
登录表单代码:
const {
email,
setEmail,
} = props;
<input
type="email"
className="form-control"
placeholder="Enter email"
value={email}
onChange={(e) => setEmail(e.target.value)}
/>
答案 0 :(得分:0)
登录页面组件
<LoginPage />
登录表单组件
import React, { useState } from "react";
const LoginForm = (props) => {
const [email, setEmail] = useState("");
return (
<>
<input
type="email"
className="form-control"
placeholder="Enter email"
value={email}
onChange={(e) => setEmail(e.target.value)}
/>
{/* Other components */}
</>
);
};