[英]How to fix "Typo in declared prop type: title" in my React linter?
I'm currently using ESLint, Airbnb lint, and Prettier to control code styling.我目前使用 ESLint、Airbnb lint 和 Prettier 来控制代码样式。 I'm getting an error in the
header.propTypes
title below.我在下面的
header.propTypes
标题中遇到错误。 I've looked at the documentation but I'm not understanding the solution.我看过文档,但我不理解解决方案。 This is a React project.
这是一个 React 项目。
The error is:错误是:
Typo in declared prop type: title
声明的道具类型中的错字:标题
What am I doing wrong here?我在这里做错了什么?
export default function Header(props) {
const { title } = props;
return (
<Helmet>
<title>{title}</title>
</Helmet>
);
}
Header.propTypes = {
title: PropTypes.title.isRequired
};
The RHS is invalid, PropTypes.title.isRequired
. RHS 无效,
PropTypes.title.isRequired
。 You probably mean to have PropTypes.string.isRequired
.您可能想拥有
PropTypes.string.isRequired
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.