首页 > 解决方案 > ESLint TableRow 未定义 - 在 .NET Core 项目中反应

问题描述

我在 .NET Core 中创建了 React 项目,并阅读了本教程来学习 React: ReactJs 组件

在上面的示例表中呈现如下:

render() {
      return (
         <div>
            <Header/>
            <table>
               <tbody>
                  {this.state.data.map((person, i) => <TableRow key = {i} 
                     data = {person} />)}
               </tbody>
            </table>
         </div>
      );
   }

我得到错误: TableRow 没有定义。什么是表格行?

标签: reactjs

解决方案


你能检查一下你是否在你的应用程序的某个地方定义了以下组件吗?

class TableRow extends React.Component {
   render() {
      return (
         <tr>
            <td>{this.props.data.id}</td>
            <td>{this.props.data.name}</td>
            <td>{this.props.data.age}</td>
         </tr>
      );
   }
}


推荐阅读