【发布时间】:2021-07-17 11:12:17
【问题描述】:
它给出了一个错误,我不知道为什么,如果你看我的代码,你会看到没有任何问题。 登录路由页面:
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)}
/>
【问题讨论】:
-
尝试使用 const [email, setEmail] = useState('') 在同一组件中本地设置它,如果可行,那么至少您知道它是导致问题的父级。
-
什么意思?我需要携带这个道具,因为有很多道具,如用户名密码等。我只要求1个道具,但其他人也有同样的问题
-
您的代码不可编译。
-
那我该怎么办@xehpuk
-
@efesahin 发布一个完整的例子。
标签: reactjs firebase authentication react-props