如何在我的 React linter 中修复“声明的道具类型中的错字:标题”?
Posted
技术标签:
【中文标题】如何在我的 React linter 中修复“声明的道具类型中的错字:标题”?【英文标题】:How to fix "Typo in declared prop type: title" in my React linter? 【发布时间】:2019-07-23 02:29:07 【问题描述】:我目前正在使用 ESLint、Airbnb lint 和 Prettier 来控制代码样式。我在下面的 header.propTypes
标题中遇到错误。我查看了documentation,但我不了解解决方案。这是一个 React 项目。
错误是:
声明的道具类型中的错字:标题
我在这里做错了什么?
export default function Header(props)
const title = props;
return (
<Helmet>
<title>title</title>
</Helmet>
);
Header.propTypes =
title: PropTypes.title.isRequired
;
【问题讨论】:
【参考方案1】:RHS 无效,PropTypes.title.isRequired
。你的意思可能是PropTypes.string.isRequired
。
【讨论】:
以上是关于如何在我的 React linter 中修复“声明的道具类型中的错字:标题”?的主要内容,如果未能解决你的问题,请参考以下文章
TypeScript 无法识别 React 正在我的 VSCode 中的 linter 中导入和使用
在我的 React 应用程序中获取 api 数据时如何修复 CORS 错误?