简体   繁体   English

如何在我的 React linter 中修复“声明的道具类型中的错字:标题”?

[英]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.

相关问题 反应项目脚本 linter 错误迭代器中缺少元素的“关键”道具 - React project script linter error Missing "key" prop for element in iterator 如何为React Native配置Linter? - How to config Linter for React Native? 反应警告:失败的道具类型:提供的“对象”类型的无效道具 - React Warning: Failed prop type: Invalid prop of type `Object` supplied TypeScript无法识别VSCode在我的linter中正在导入和使用React - TypeScript does not recognize that React is being imported and used in my linter in VSCode 如何修复“仅在 ES6 中可用”的 linter 错误? - How to fix “only available in ES6” linter errors? 如何修复专用组件中的“禁止传播道具”? - How to fix “Prop spreading is forbidden” in specialized component? 警告:失败的道具类型:游戏:道具类型`游戏`无效; 它必须是一个函数,通常来自React.PropTypes - Warning: Failed prop type: Game: prop type `game` is invalid; it must be a function, usually from React.PropTypes VSCode自定义“修复”选项,应用短绒规则 - VSCode custom 'Fix' option, applying linter rules React Prettier - 如何删除字符串的支撑括号 - React Prettier - how to remove the prop brackets for string 获取 linter 错误“Unexpected token =”,对先前声明的变量进行解构赋值 - Getting linter error “Unexpected token =” with destructuring assignment on previously declared variables
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM