ESLint/eslint-plugin-react:修订间差异
来自康健生活
< ESLint
| 第10行: | 第10行: | ||
const Test = React.forwardRef((props, ref) => { return <input {...props} />}); | const Test = React.forwardRef((props, ref) => { return <input {...props} />}); | ||
Test.displayName = 'Test';</syntaxhighlight> | Test.displayName = 'Test';</syntaxhighlight> | ||
* React version not specified in eslint-plugin-react settings. See https://github.com/yannickcr/eslint-plugin-react#configuration . | |||
: 在eslintrc.js或者.eslintrc文件中添加配置项: | |||
: <syntaxhighlight lang="javascript"> | |||
"settings": { | |||
"react": { | |||
"version": "detect" | |||
} | |||
}</syntaxhighlight> | |||
2022年6月6日 (一) 04:56的最新版本
标题文字
error
function React.forwardRef<any, {}>(render: React.ForwardRefRenderFunction<any, {}>): React.ForwardRefExoticComponent<React.RefAttributes<any>>Component definition is missing display nameeslintreact/display-name
- 组件定义缺少显示名称
const Test = React.forwardRef(function Input(props, ref) { return <input {...props} />});
- or
const Test = React.forwardRef((props, ref) => { return <input {...props} />}); Test.displayName = 'Test';
- React version not specified in eslint-plugin-react settings. See https://github.com/yannickcr/eslint-plugin-react#configuration .
- 在eslintrc.js或者.eslintrc文件中添加配置项:
"settings": { "react": { "version": "detect" } }
No categories