gpt4 book ai didi

eslint - 如何在我的 React linter 中修复 "Typo in declared prop type: title"?

转载 作者:行者123 更新时间:2023-12-02 14:52:25 24 4
gpt4 key购买 nike

我目前正在使用 ESLint、Airbnb lint 和 Prettier 来控制代码样式。我在下面的 header.propTypes 标题中遇到错误。我看过 documentation但我不理解解决方案。这是一个 React 项目。

错误是:

Typo in declared prop type: title

我在这里做错了什么?

export default function Header(props) {
const { title } = props;
return (
<Helmet>
<title>{title}</title>
</Helmet>
);
}

Header.propTypes = {
title: PropTypes.title.isRequired
};

最佳答案

RHS 无效,PropTypes.title.isRequired。您可能想要 PropTypes.string.isRequired

关于eslint - 如何在我的 React linter 中修复 "Typo in declared prop type: title"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54938145/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com