我想根据传递的数据动态呈现 rsuite 表中的表列和行,而不对列和数据进行硬编码。
从'rsuite-table'导入{表,列,HeaderCell,单元格,行数据类型};导入“rsuite-table/dist/css/rsuite-table.css”
从“反应”导入反应
导出默认函数 App() {
// Sample table data
const sampleData : any[] = [
{ firstName: 'Gourav', lastName: 'Hammad', city: 'Mhow' },
{ firstName: 'Rithik', lastName: 'Verma', city: 'Indore' },
{ firstName: 'Kartik', lastName: 'Malik', city: 'Raipur' },
{ firstName: 'Nikhil', lastName: 'Kapoor', city: 'Rau' },
{ firstName: 'Ayush', lastName: 'Singh', city: 'Dewas' }
]
return (
<div style={{
display: 'block', width: 700, paddingLeft: 30
}}>
<h4>React Suite Table Component</h4>
<Table
height={500}
data={sampleData}
>
here I want to generate the column and row based on given data
</Table>
</div>
);
}