javascript - 在 next.js 打字稿中传递状态时,我不断收到:不可分配给类型“IntrinsicAttributes”
问题描述
我正在尝试将我的 react next.js typescript 应用程序中的状态从 index.tsx 页面传递到我的注册组件,但是我不断收到电子邮件 useState 挂钩上的错误:
键入'{电子邮件:字符串;}' 不可分配给类型“IntrinsicAttributes”。类型“IntrinsicAttributes”上不存在属性“电子邮件”。
我将如何解决这个问题,我的代码如下
export default function Home() {
// state to handle signup email and password
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
return (
<div className={styles.container}>
<title>
example
</title>
<div className={styles.container}>
</div>
<Signup email={email} /> //The error shows up here as I am passing the state
<Login />
<link rel="icon" href="/favicon.ico" />
</div>
);
}
解决方案
推荐阅读
- javascript - 如何在每个单词后重置 javascript 语音识别
- r - 应用地图或修改后如何在小标题中保留变量类型
- python - 如何始终在交互式 matplotlib 窗口中包含完整的图例/额外的艺术家
- automated-tests - cypress 中的工具提示测试
- html - 使用大型自定义拇指图像扩展输入范围的移动
- php - 按性别和年龄对多维数组进行排序
- php - 如何检查多个日期范围之间的重叠日期?
- windows - Docker 拉未经授权:需要身份验证
- c# - .NET Core 与 .NET Framework,我的代码作为 .NET Core 的一部分工作,但不作为 .NET 框架的一部分,为什么?
- scikit-learn - 如何将一组数字分成两个簇并返回对应索引的两个子集?