ESLint/eslint-plugin-react:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
第3行: 第3行:
* <syntaxhighlight lang="javascript" inline>
* <syntaxhighlight lang="javascript" inline>
function React.forwardRef<any, {}>(render: React.ForwardRefRenderFunction<any, {}>): React.ForwardRefExoticComponent<React.RefAttributes<any>></syntaxhighlight> Component definition is missing display nameeslintreact/display-name
function React.forwardRef<any, {}>(render: React.ForwardRefRenderFunction<any, {}>): React.ForwardRefExoticComponent<React.RefAttributes<any>></syntaxhighlight> Component definition is missing display nameeslintreact/display-name
: 组件定义缺少显示名称
: <syntaxhighlight lang="javascript">
: <syntaxhighlight lang="javascript">
const Test = React.forwardRef(function Input(props, ref) { return <input {...props} />});</syntaxhighlight>
const Test = React.forwardRef(function Input(props, ref) { return <input {...props} />});</syntaxhighlight>

2022年3月25日 (五) 08:51的版本

标题文字

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';