Example 1.1 2
Wed May 15 2024 10:04:04 GMT+0000 (Coordinated Universal Time)
Saved by
@beyza
// src/components/TableComponent.js
import React from 'react';
const TableComponent = () => {
const data = [
{ id: 1, name: 'John Doe', age: 28 },
{ id: 2, name: 'Jane Smith', age: 34 },
{ id: 3, name: 'Sam Johnson', age: 45 },
];
return (
<div>
<h2>Table Component</h2>
<table border="1">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Age</th>
</tr>
</thead>
<tbody>
{data.map((item) => (
<tr key={item.id}>
<td>{item.id}</td>
<td>{item.name}</td>
<td>{item.age}</td>
</tr>
))}
</tbody>
</table>
</div>
);
};
export default TableComponent;
content_copyCOPY
https://chatgpt.com/c/3e4f5a44-577a-4ca4-970d-80b8a2a76efa
Comments